Search in sources :

Example 1 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project moon by gentoo111.

the class DruidConfig method druidServlet.

@Bean
public ServletRegistrationBean druidServlet() {
    log.info("init Druid Servlet Configuration ");
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    // IP白名单
    servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
    // 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 2 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project vip by guangdada.

the class WebConfig method druidServletRegistration.

/**
 * druidServlet注册
 */
@Bean
public ServletRegistrationBean druidServletRegistration() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new StatViewServlet());
    registration.addUrlMappings("/druid/*");
    return registration;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) StatViewServlet(com.alibaba.druid.support.http.StatViewServlet) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ServletListenerRegistrationBean(org.springframework.boot.web.servlet.ServletListenerRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project neweagle-api by apgzs.

the class DruidConfiguration method druidServlet.

@Bean
public ServletRegistrationBean druidServlet() {
    logger.info("init Druid Servlet Configuration ");
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
    servletRegistrationBean.setServlet(new StatViewServlet());
    servletRegistrationBean.addUrlMappings("/druid/*");
    Map<String, String> initParameters = new HashMap<String, String>();
    // 用户名
    initParameters.put("loginUsername", "admin");
    // 密码
    initParameters.put("loginPassword", "admin");
    // 禁用HTML页面上的“Reset All”功能
    initParameters.put("resetEnable", "false");
    // IP白名单 (没有配置或者为空,则允许所有访问)
    initParameters.put("allow", "");
    servletRegistrationBean.setInitParameters(initParameters);
    return servletRegistrationBean;
}
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) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project Spring-Family by Sierou-Java.

the class MasterDataSourceConfig method druidServlet.

@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
    servletRegistrationBean.setServlet(new StatViewServlet());
    servletRegistrationBean.addUrlMappings("/druid/*");
    return servletRegistrationBean;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) StatViewServlet(com.alibaba.druid.support.http.StatViewServlet) SqlSessionFactoryBean(org.mybatis.spring.SqlSessionFactoryBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with StatViewServlet

use of com.alibaba.druid.support.http.StatViewServlet in project cloud-sea-towerman by huadahuang1983.

the class DataSourceConfig method druidServlet.

@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean reg = new ServletRegistrationBean();
    reg.setServlet(new StatViewServlet());
    reg.addUrlMappings("/druid/*");
    reg.addInitParameter("loginUsername", "druid");
    reg.addInitParameter("loginPassword", "druid");
    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