mirror of
https://github.com/drtrang/druid-spring-boot.git
synced 2026-11-15 10:44:04 +00:00
1.1.10.2
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2-actuator</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2-actuator-autoconfigure</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2-actuator</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2-actuator-starter</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2-parent</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2-actuator</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2-example</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2-jpa-example</artifactId>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class SpringDataSourceConfig {
|
||||
|
||||
/**
|
||||
* 自定义 DruidDataSource,所有的数据源都会生效
|
||||
* 定制化 DruidDataSource,所有的数据源都会生效
|
||||
*
|
||||
* @return druidDataSourceCustomizer
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2-example</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2-mybatis-example</artifactId>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class SpringDataSourceConfig {
|
||||
|
||||
/**
|
||||
* 自定义 DruidDataSource,所有的数据源都会生效
|
||||
* 定制化 DruidDataSource,所有的数据源都会生效
|
||||
*
|
||||
* @return druidDataSourceCustomizer
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2-parent</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2-example</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2-autoconfigure</artifactId>
|
||||
|
||||
+10
-11
@@ -129,21 +129,20 @@ public class DruidDataSourceConfiguration {
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof DruidDataSource) {
|
||||
if (dataSources.isEmpty()) {
|
||||
log.info("druid single data-source({}) init...", beanName);
|
||||
} else {
|
||||
log.info("druid dynamic data-source({}) init...", beanName);
|
||||
}
|
||||
// 设置 Druid 名称
|
||||
((DruidDataSource) bean).setName(beanName);
|
||||
DruidDataSource druidDataSource = (DruidDataSource) bean;
|
||||
druidDataSource.setName(beanName);
|
||||
// 将 'spring.datasource.druid.data-sources.${name}' 的配置绑定到 Bean
|
||||
if (!dataSources.isEmpty()) {
|
||||
Binder.get(environment).bind(PREFIX + "." + beanName, Bindable.ofInstance(bean));
|
||||
}
|
||||
// 用户自定义配置,拥有最高优先级
|
||||
for (DruidDataSourceCustomizer customizer : customizers) {
|
||||
customizer.customize((DruidDataSource) bean);
|
||||
}
|
||||
if (dataSources.isEmpty()) {
|
||||
log.debug("druid single data-source({}) init...", beanName);
|
||||
} else {
|
||||
log.debug("druid dynamic data-source({}) init...", beanName);
|
||||
Binder.get(environment).bind(PREFIX + "." + beanName, Bindable.ofInstance(druidDataSource));
|
||||
}
|
||||
// 定制化配置,拥有最高优先级,会覆盖之前已有的配置
|
||||
customizers.forEach(customizer -> customizer.customize(druidDataSource));
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,14 +3,14 @@ package com.github.trang.druid.autoconfigure;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
|
||||
/**
|
||||
* DruidDataSource 的回调接口,可以在 DruidDataSource 初始化之前对其进行自定义
|
||||
* DruidDataSource 的回调接口,可以在 DruidDataSource 初始化之前对其进行定制
|
||||
*
|
||||
* @author trang
|
||||
*/
|
||||
public interface DruidDataSourceCustomizer {
|
||||
|
||||
/**
|
||||
* 自定义 DruidDataSource
|
||||
* 定制化 DruidDataSource
|
||||
*
|
||||
* @param druidDataSource druid 数据源
|
||||
*/
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class DruidServletConfiguration {
|
||||
*/
|
||||
@Bean
|
||||
public ServletRegistrationBean druidStatViewServlet(DruidDataSourceProperties druidProperties) {
|
||||
log.debug("druid stat-view-servlet init...");
|
||||
log.info("druid stat-view-servlet init...");
|
||||
DruidStatViewServletProperties properties = druidProperties.getStatViewServlet();
|
||||
ServletRegistrationBean<StatViewServlet> registration = new ServletRegistrationBean<>(new StatViewServlet());
|
||||
registration.addUrlMappings(properties.getUrlMappings());
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ public class DruidStatConfiguration {
|
||||
|
||||
@Bean
|
||||
public DefaultAdvisorAutoProxyCreator druidStatProxy() {
|
||||
log.debug("druid aop-stat init...");
|
||||
log.info("druid aop-stat init...");
|
||||
DefaultAdvisorAutoProxyCreator druidStatProxyCreator = new DefaultAdvisorAutoProxyCreator();
|
||||
druidStatProxyCreator.setProxyTargetClass(proxyTargetClass);
|
||||
return druidStatProxyCreator;
|
||||
@@ -80,7 +80,7 @@ public class DruidStatConfiguration {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean druidWebStatFilter(DruidDataSourceProperties druidProperties) {
|
||||
log.debug("druid web-stat-filter init...");
|
||||
log.info("druid web-stat-filter init...");
|
||||
DruidWebStatProperties properties = druidProperties.getWebStat();
|
||||
FilterRegistrationBean<WebStatFilter> registration = new FilterRegistrationBean<>(new WebStatFilter());
|
||||
registration.addUrlPatterns(properties.getUrlPatterns());
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2-starter</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2-parent</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>druid-spring-boot2</artifactId>
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
<parent>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>parent2</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>1.3.2</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot2-parent</artifactId>
|
||||
<version>1.1.10.1</version>
|
||||
<version>1.1.10.2</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>druid-spring-boot2-parent</name>
|
||||
|
||||
Reference in New Issue
Block a user