Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
task3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
首航-临时账号
task3.0
Commits
fdd2acfc
Commit
fdd2acfc
authored
May 08, 2019
by
zt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改-linux服务器上不设置配置文件就加载默认的, 已解决
parent
f1b64f3d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
7 deletions
+12
-7
pom.xml
pom.xml
+1
-1
DbSoundsMonitorTask.java
src/main/java/com/foc/DbSoundsMonitorTask.java
+9
-4
PropertiesUtils.java
src/main/java/com/foc/util/PropertiesUtils.java
+1
-1
mybatis-config.xml
src/main/resources/mybatis-config.xml
+1
-1
No files found.
pom.xml
View file @
fdd2acfc
...
...
@@ -15,6 +15,7 @@
</properties>
<dependencies>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
...
...
@@ -68,7 +69,6 @@
<version>
5.1.4.RELEASE
</version>
</dependency>
<!-- 封装实体依赖 -->
<dependency>
<groupId>
org.projectlombok
</groupId>
...
...
src/main/java/com/foc/DbSoundsMonitorTask.java
View file @
fdd2acfc
...
...
@@ -5,11 +5,8 @@ import com.foc.entity.AccessInfo;
import
com.foc.entity.SmsResult
;
import
com.foc.service.Sms
;
import
com.foc.service.SoundMonitorService
;
import
com.foc.util.PropertiesUtils
;
import
lombok.extern.log4j.Log4j
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.Date
;
import
java.util.Properties
;
...
...
@@ -29,7 +26,10 @@ public class DbSoundsMonitorTask {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
args
==
null
||
args
.
length
==
0
){
loadConf
(
Thread
.
currentThread
().
getContextClassLoader
().
getResource
(
"global.properties"
).
getPath
());
//本地启动是可以。到了服务器变成了java.io.FileNotFoundException: file:/data/smsAndEmailTest/task-3.0-SNAPSHOT.jar!/global.properties (No such file or directory)
//loadConf(Thread.currentThread().getContextClassLoader().getResource("global.properties").getPath());
Properties
properties
=
PropertiesUtils
.
getProperties
();
load
(
properties
);
}
else
{
loadConf
(
args
[
0
]);
}
...
...
@@ -37,6 +37,10 @@ public class DbSoundsMonitorTask {
public
static
void
loadConf
(
String
path
)
throws
Exception
{
Properties
properties
=
PropertiesUtils
.
getProperties
(
path
);
load
(
properties
);
}
public
static
void
load
(
Properties
properties
){
String
aicc
=
properties
.
getProperty
(
"aicc"
);
String
aicp
=
properties
.
getProperty
(
"aicp"
);
String
resultCode
=
properties
.
getProperty
(
"resultCode"
);
...
...
@@ -59,4 +63,5 @@ public class DbSoundsMonitorTask {
log
.
info
(
"没有异常!"
);
}
}
}
src/main/java/com/foc/util/PropertiesUtils.java
View file @
fdd2acfc
...
...
@@ -34,7 +34,7 @@ public class PropertiesUtils {
if
(
properties
==
null
){
properties
=
new
Properties
();
try
{
properties
.
load
(
new
InputStreamReader
(
PropertiesUtils
.
class
.
getClassLoader
().
getResourceAsStream
(
"
server
.properties"
),
"UTF-8"
));
properties
.
load
(
new
InputStreamReader
(
PropertiesUtils
.
class
.
getClassLoader
().
getResourceAsStream
(
"
global
.properties"
),
"UTF-8"
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
src/main/resources/mybatis-config.xml
View file @
fdd2acfc
...
...
@@ -47,7 +47,7 @@
<dataSource
type=
"POOLED"
>
<property
name=
"driver"
value=
"com.mysql.jdbc.Driver"
/>
<!--<property name="url" value="jdbc:mysql://106.75.97.50:3306/jd_foc"/>-->
<property
name=
"url"
value=
"
jdbc:mysql://mysql_server:3306/foc?useUnicode=true&
characterEncoding=utf-8"
/>
<property
name=
"url"
value=
"
jdbc:mysql://mysql_server:3306/foc?useUnicode=true&
characterEncoding=utf-8"
/>
<property
name=
"username"
value=
"focuser"
/>
<property
name=
"password"
value=
"FOC@2016"
/>
</dataSource>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment