Search in sources :

Example 16 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project tesla by linking12.

the class DruidDBConfig method druidServlet.

@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean reg = new ServletRegistrationBean();
    reg.setServlet(new StatViewServlet());
    reg.addUrlMappings("/druid/*");
    // 白名单
    reg.addInitParameter("allow", "");
    return reg;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) StatViewServlet(com.alibaba.druid.support.http.StatViewServlet) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 17 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project elephant by yanghuijava.

the class DruidConfiguration method druidServlet.

@Bean
public ServletRegistrationBean druidServlet() {
    logger.info("init Druid Servlet Configuration ");
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    // IP白名单
    servletRegistrationBean.addInitParameter("allow", "");
    // IP黑名单(共同存在时,deny优先于allow)
    // servletRegistrationBean.addInitParameter("deny", "");
    // 控制台管理用户
    servletRegistrationBean.addInitParameter("loginUsername", "admin");
    servletRegistrationBean.addInitParameter("loginPassword", "admin");
    // 是否能够重置数据 禁用HTML页面上的“Reset All”功能
    servletRegistrationBean.addInitParameter("resetEnable", "false");
    return servletRegistrationBean;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) StatViewServlet(com.alibaba.druid.support.http.StatViewServlet) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 18 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project CBEC-B2B by A-Cubic.

the class DataSourceConfig method servletRegistrationBean.

// 数据源监控
@Bean
public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean();
    registration.setServlet(new StatViewServlet());
    registration.setName("druid");
    registration.setUrlMappings(Lists.newArrayList("/druid/*"));
    // 自定义添加初始化参数
    Map<String, String> intParams = new HashMap<>();
    intParams.put("loginUsername", "admin");
    intParams.put("loginPassword", "llwell@druid");
    registration.setName("DruidWebStatFilter");
    registration.setInitParameters(intParams);
    return registration;
}
Also used : HashMap(java.util.HashMap) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) StatViewServlet(com.alibaba.druid.support.http.StatViewServlet) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) SqlSessionFactoryBean(org.mybatis.spring.SqlSessionFactoryBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 19 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project Ganster-CMS by Gangster-trio.

the class DruidConfig method druidServlet.

@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    // 登录查看信息的账号密码.
    servletRegistrationBean.addInitParameter("loginUsername", "admin");
    servletRegistrationBean.addInitParameter("loginPassword", "123456");
    return servletRegistrationBean;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) StatViewServlet(com.alibaba.druid.support.http.StatViewServlet) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 20 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project flybiner-sso by youyouxi.

the class DruidConfig method druidServlet.

@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean reg = new ServletRegistrationBean();
    reg.setServlet(new StatViewServlet());
    reg.addUrlMappings("/druid/*");
    reg.addInitParameter("loginUsername", "chenjianbin");
    reg.addInitParameter("loginPassword", "123456");
    return reg;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) StatViewServlet(com.alibaba.druid.support.http.StatViewServlet) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

StatViewServlet (com.alibaba.druid.support.http.StatViewServlet)23 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)13 Bean (org.springframework.context.annotation.Bean)13 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)11 MockServletConfig (org.springframework.mock.web.MockServletConfig)10 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)4 HashMap (java.util.HashMap)2 SqlSessionFactoryBean (org.mybatis.spring.SqlSessionFactoryBean)2 DruidStatProperties (com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties)1 ServletListenerRegistrationBean (org.springframework.boot.web.servlet.ServletListenerRegistrationBean)1