支持读取druid特殊配置url
This commit is contained in:
parent
a9f7a54bf8
commit
850329960b
|
@ -253,6 +253,9 @@ public class ContextHelper implements ApplicationContextAware {
|
||||||
public static String getJdbcUrl() {
|
public static String getJdbcUrl() {
|
||||||
Environment environment = getApplicationContext().getEnvironment();
|
Environment environment = getApplicationContext().getEnvironment();
|
||||||
String jdbcUrl = environment.getProperty("spring.datasource.url");
|
String jdbcUrl = environment.getProperty("spring.datasource.url");
|
||||||
|
if(jdbcUrl == null){
|
||||||
|
jdbcUrl = environment.getProperty("spring.datasource.druid.url");
|
||||||
|
}
|
||||||
if(jdbcUrl == null){
|
if(jdbcUrl == null){
|
||||||
String master = environment.getProperty("spring.datasource.dynamic.primary");
|
String master = environment.getProperty("spring.datasource.dynamic.primary");
|
||||||
jdbcUrl = environment.getProperty("spring.datasource.dynamic.datasource."+master+".url");
|
jdbcUrl = environment.getProperty("spring.datasource.dynamic.datasource."+master+".url");
|
||||||
|
|
Loading…
Reference in New Issue