diff --git a/config/application-test.properties b/config/application-test.properties index 715351d4..77de0ca5 100644 --- a/config/application-test.properties +++ b/config/application-test.properties @@ -4,15 +4,15 @@ server.tomcat.basedir=./basedir # 多个项目放在nginx下同个端口,通过该配置区分 server.servlet.context-path=/dispose # 配置数据源 -spring.datasource.url=jdbc:mysql://10.88.77.65:33061/ci_dispose_v2?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior\ - =convertToNull&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.username=root -spring.datasource.password=h0K0_8u -#spring.datasource.url=jdbc:mysql://172.28.72.118:33061/ci_dispose_v2?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true +#spring.datasource.url=jdbc:mysql://10.88.77.65:33061/ci_dispose_v2?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior\ +# =convertToNull&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true #spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -#spring.datasource.username=phoenix -#spring.datasource.password=ENC@yr1dDL7FO8J642rqx5sD7Q== +#spring.datasource.username=root +#spring.datasource.password=h0K0_8u +spring.datasource.url=jdbc:mysql://172.28.72.118:33061/ci_dispose_v2?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.username=phoenix +spring.datasource.password=Hy@rfph32 # 配置连接池 spring.datasource.schema=classpath:test_db/unit_test.sql diff --git a/src/main/java/com/dispose/config/CfgFileSecurityConfigure.java b/src/main/java/com/dispose/config/CfgFileSecurityConfigure.java index bbb56efd..b00793ad 100644 --- a/src/main/java/com/dispose/config/CfgFileSecurityConfigure.java +++ b/src/main/java/com/dispose/config/CfgFileSecurityConfigure.java @@ -28,21 +28,27 @@ public class CfgFileSecurityConfigure { public EncryptionPropertyResolver encryptablePropertyResolver() throws IOException { InputStream is = ClassLoader.getSystemResourceAsStream("git.properties"); assert is != null; + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String password = ""; - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - log.info("Version Information:"); - while (true) { - String val = reader.readLine(); - log.info("{}", val); + try { + log.info("Version Information:"); + while (true) { + String val = reader.readLine(); + log.info("{}", val); - if (val == null) { - break; - } + if (val == null) { + break; + } - if (val.startsWith("git.commit.id=")) { - password = val.substring("git.commit.id=".length()); + if (val.startsWith("git.commit.id=")) { + password = val.substring("git.commit.id=".length()); + } } + } catch (IOException ex) { + log.error("EncryptablePropertyResolver exception, used default password"); + } finally { + reader.close(); } return new EncryptionPropertyResolver(password);