|
@@ -10,6 +10,7 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
|
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.context.annotation.Primary;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
|
|
|
@@ -19,17 +20,20 @@ import javax.sql.DataSource;
|
|
|
@EnableTransactionManagement
|
|
|
public class DataSourceConfig {
|
|
|
|
|
|
+ @Primary
|
|
|
@Bean
|
|
|
- @ConfigurationProperties(prefix = "spring.datasource")
|
|
|
+ @Qualifier("oss")
|
|
|
+ @ConfigurationProperties(prefix = "spring.datasource.oss")
|
|
|
public DataSource druidDataSource() {
|
|
|
return new DruidDataSource();
|
|
|
}
|
|
|
|
|
|
-// @Bean
|
|
|
-// @ConfigurationProperties(prefix = "spring.datasource.runtime")
|
|
|
-// DataSource runtime() {
|
|
|
-// return DruidDataSourceBuilder.create().build();
|
|
|
-// }
|
|
|
+ @Bean
|
|
|
+ @Qualifier("runtime")
|
|
|
+ @ConfigurationProperties(prefix = "spring.datasource.runtime")
|
|
|
+ DataSource runtime() {
|
|
|
+ return DruidDataSourceBuilder.create().build();
|
|
|
+ }
|
|
|
|
|
|
@Bean
|
|
|
public ServletRegistrationBean druidServlet() {
|
|
@@ -45,10 +49,9 @@ public class DataSourceConfig {
|
|
|
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
|
|
|
return filterRegistrationBean;
|
|
|
}
|
|
|
-//
|
|
|
-// @Bean
|
|
|
-// JdbcTemplate jdbcTemplateRuntime(@Qualifier("runtime") DataSource base) {
|
|
|
-// return new JdbcTemplate(base);
|
|
|
-// }
|
|
|
-//}
|
|
|
+ //
|
|
|
+ @Bean
|
|
|
+ JdbcTemplate jdbcTemplateRuntime(@Qualifier("runtime") DataSource base) {
|
|
|
+ return new JdbcTemplate(base);
|
|
|
+ }
|
|
|
}
|