mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
update > optimize the config follow the spring standard & help IDE quick hints
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@ public class DruidDataSourceAutoConfigure {
|
||||
dataSource.setDriverClassName(env.getProperty("spring.datasource.driver-class-name"));
|
||||
}
|
||||
// set filters default value on StatViewServlet enabled.
|
||||
if (! "false".equals(env.getProperty("spring.datasource.druid.StatViewServlet.enabled"))) {
|
||||
if (!"false".equals(env.getProperty("spring.datasource.druid.stat-view-servlet.enabled"))) {
|
||||
try {
|
||||
dataSource.setFilters("stat");
|
||||
} catch (SQLException e) {
|
||||
|
||||
+18
@@ -52,6 +52,7 @@ public class DruidStatProperties {
|
||||
}
|
||||
|
||||
public static class StatViewServlet {
|
||||
private boolean enabled;
|
||||
private String urlPattern;
|
||||
private String allow;
|
||||
private String deny;
|
||||
@@ -59,6 +60,14 @@ public class DruidStatProperties {
|
||||
private String loginPassword;
|
||||
private String resetEnable;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getUrlPattern() {
|
||||
return urlPattern;
|
||||
}
|
||||
@@ -109,6 +118,7 @@ public class DruidStatProperties {
|
||||
}
|
||||
|
||||
public static class WebStatFilter {
|
||||
private boolean enabled;
|
||||
private String urlPattern;
|
||||
private String exclusions;
|
||||
private String sessionStatMaxCount;
|
||||
@@ -117,6 +127,14 @@ public class DruidStatProperties {
|
||||
private String principalCookieName;
|
||||
private String profileEnable;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getUrlPattern() {
|
||||
return urlPattern;
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.springframework.context.annotation.Bean;
|
||||
* @author lihengming [89921218@qq.com]
|
||||
*/
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnProperty(name = "spring.datasource.druid.StatViewServlet.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnProperty(name = {"spring.datasource.druid.stat-view-servlet.enabled"}, havingValue = "true", matchIfMissing = true)
|
||||
public class DruidStatViewServletConfiguration {
|
||||
@Bean
|
||||
public ServletRegistrationBean servletRegistrationBean(DruidStatProperties properties) {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.springframework.context.annotation.Bean;
|
||||
* @author lihengming [89921218@qq.com]
|
||||
*/
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnProperty(name = "spring.datasource.druid.WebStatFilter.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnProperty(name = "spring.datasource.druid.web-stat-filter.enabled", havingValue = "true", matchIfMissing = true)
|
||||
public class DruidWebStatFilterConfiguration {
|
||||
@Bean
|
||||
public FilterRegistrationBean filterRegistrationBean(DruidStatProperties properties) {
|
||||
|
||||
Reference in New Issue
Block a user