|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.nmgs;
|
|
|
|
|
|
|
|
|
|
import com.nmgs.config.Constant;
|
|
|
|
|
import com.nmgs.util.PathUtil;
|
|
|
|
|
import com.nmgs.util.PropertiesUtil;
|
|
|
|
|
import com.trkf.PasswordEncryption.PassWordUtils;
|
|
|
|
|
@ -43,31 +44,39 @@ public class MyEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
|
|
|
|
properties.load(new FileInputStream(path));
|
|
|
|
|
String DBType = properties.getProperty("DBType") == null ? "1" : properties.getProperty("DBType");
|
|
|
|
|
Newproperties.load(new FileInputStream(NewPath));
|
|
|
|
|
properties.setProperty("spring.logback.logPath",PathUtil.TomcatPath+"/logs");
|
|
|
|
|
properties.setProperty("spring.datasource.url",properties.getProperty("DBUrl"));
|
|
|
|
|
properties.setProperty("spring.datasource.username",properties.getProperty("DBUserName"));
|
|
|
|
|
properties.setProperty("spring.datasource.password",PassWordUtils.decrypt(properties.getProperty("DBPassWord")));
|
|
|
|
|
switch (DBType) {
|
|
|
|
|
case "1":
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("sqlClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("sqlvalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("sqlvalidationQuery"));
|
|
|
|
|
break;
|
|
|
|
|
case "2":
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("OracleClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("OraclevalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("OraclevalidationQuery"));
|
|
|
|
|
break;
|
|
|
|
|
case "3":
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("DMClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("DMvalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("DMvalidationQuery"));
|
|
|
|
|
break;
|
|
|
|
|
case "4":
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("MySQLClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("MySQLvalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("MySQLvalidationQuery"));
|
|
|
|
|
break;
|
|
|
|
|
//获取是否是goldenDB数据库
|
|
|
|
|
String IsGolDen = properties.getProperty("IsGolDen") == null ? "0" : properties.getProperty("IsGolDen");
|
|
|
|
|
properties.setProperty("spring.logback.logPath", PathUtil.TomcatPath + "/logs");
|
|
|
|
|
properties.setProperty("spring.datasource.url", properties.getProperty("DBUrl"));
|
|
|
|
|
properties.setProperty("spring.datasource.username", properties.getProperty("DBUserName"));
|
|
|
|
|
properties.setProperty("spring.datasource.password", PassWordUtils.decrypt(properties.getProperty("DBPassWord")));
|
|
|
|
|
if(Constant.STR_ONE.equals(IsGolDen)){
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("GoldenDBClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("GoldenvalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("GoldenvalidationQuery"));
|
|
|
|
|
}else {
|
|
|
|
|
switch (DBType) {
|
|
|
|
|
case "1":
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("sqlClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("sqlvalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("sqlvalidationQuery"));
|
|
|
|
|
break;
|
|
|
|
|
case "2":
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("OracleClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("OraclevalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("OraclevalidationQuery"));
|
|
|
|
|
break;
|
|
|
|
|
case "3":
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("DMClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("DMvalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("DMvalidationQuery"));
|
|
|
|
|
break;
|
|
|
|
|
case "4":
|
|
|
|
|
properties.setProperty("spring.datasource.driver-class-name", Newproperties.getProperty("MySQLClassName"));
|
|
|
|
|
properties.setProperty("spring.datasource.validationQuery", Newproperties.getProperty("MySQLvalidationQuery"));
|
|
|
|
|
properties.setProperty("spring.datasource.hikari.connection-test-query", Newproperties.getProperty("MySQLvalidationQuery"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
System.out.println("---------------------------OverLimitDetection本次载入数据库----------------------");
|
|
|
|
|
System.out.println("server.port: " + properties.getProperty("server.port"));
|
|
|
|
|
|