You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.2 KiB
31 lines
1.2 KiB
package com.mdp;
|
|
|
|
import com.alibaba.druid.support.http.StatViewServlet;
|
|
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
/**
|
|
* 要使用mdp平台功能,必须 扫码com.mdp包
|
|
* 一些默认公共配置
|
|
*/
|
|
@Configuration
|
|
public class DruidConfig {
|
|
|
|
/**
|
|
* @description 注册一个StatViewServlet,进行druid监控页面配置
|
|
* @return servlet registration bean
|
|
*/
|
|
|
|
|
|
@Bean
|
|
public ServletRegistrationBean<StatViewServlet> druidStatViewServlet() {
|
|
ServletRegistrationBean<StatViewServlet> registrationBean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
|
|
registrationBean.addInitParameter("allow", "127.0.0.1");// IP白名单 (没有配置或者为空,则允许所有访问)
|
|
registrationBean.addInitParameter("deny", "");// IP黑名单 (存在共同时,deny优先于allow)
|
|
registrationBean.addInitParameter("loginUsername", "root");
|
|
registrationBean.addInitParameter("loginPassword", "1234");
|
|
registrationBean.addInitParameter("resetEnable", "false");
|
|
return registrationBean;
|
|
}
|
|
}
|