com.alibaba.druid.support.http.StatViewServlet Java Examples

The following examples show how to use com.alibaba.druid.support.http.StatViewServlet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DruidConfiguration.java    From MicroCommunity with Apache License 2.0 6 votes vote down vote up
/**
 * 注册一个StatViewServlet
 *
 * @return ServletRegistrationBean
 */
//@Bean
public ServletRegistrationBean DruidStatViewServle2() {
    //org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册.
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid2/*");

    //添加初始化参数:initParams

    //白名单:
    servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
    //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
    servletRegistrationBean.addInitParameter("deny", "192.168.1.73");
    //登录查看信息的账号密码.
    servletRegistrationBean.addInitParameter("loginUsername", "admin2");
    servletRegistrationBean.addInitParameter("loginPassword", "123456");
    //是否能够重置数据.
    servletRegistrationBean.addInitParameter("resetEnable", "false");
    return servletRegistrationBean;
}
 
Example #2
Source File: DruidConfiguration.java    From springBoot-study with Apache License 2.0 6 votes vote down vote up
@Bean
public ServletRegistrationBean druidStatViewServle() {
	//注册服务
	ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(
			new StatViewServlet(), "/druid/*");
	// 白名单(为空表示,所有的都可以访问,多个IP的时候用逗号隔开)
	servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
	// IP黑名单 (存在共同时,deny优先于allow) 
	servletRegistrationBean.addInitParameter("deny", "127.0.0.2");
	// 设置登录的用户名和密码
	servletRegistrationBean.addInitParameter("loginUsername", "pancm");
	servletRegistrationBean.addInitParameter("loginPassword", "123456");
	// 是否能够重置数据.
	servletRegistrationBean.addInitParameter("resetEnable", "false");
	return servletRegistrationBean;
}
 
Example #3
Source File: DruidServletConfiguration.java    From druid-spring-boot with Apache License 2.0 6 votes vote down vote up
/**
 * Druid 提供了一个 StatViewServlet 用于展示 Druid 的统计信息
 * 这个 StatViewServlet 的用途包括:
 *   1. 提供监控信息展示的 HTML 页面
 *   2. 提供监控信息的 JSON API
 */
@Bean
public ServletRegistrationBean druidStatViewServlet(DruidDataSourceProperties druidProperties) {
    log.debug("druid stat-view-servlet init...");
    DruidStatViewServletProperties properties = druidProperties.getStatViewServlet();
    ServletRegistrationBean registration = new ServletRegistrationBean(new StatViewServlet());
    registration.addUrlMappings(properties.getUrlMappings());
    if (!StringUtils.isEmpty(properties.getLoginUsername())) {
        registration.addInitParameter("loginUsername", properties.getLoginUsername());
    }
    if (!StringUtils.isEmpty(properties.getLoginPassword())) {
        registration.addInitParameter("loginPassword", properties.getLoginPassword());
    }
    if (!StringUtils.isEmpty(properties.getAllow())) {
        registration.addInitParameter("allow", properties.getAllow());
    }
    if (!StringUtils.isEmpty(properties.getDeny())) {
        registration.addInitParameter("deny", properties.getDeny());
    }
    registration.addInitParameter("resetEnable", Boolean.toString(properties.isResetEnable()));
    return registration;
}
 
Example #4
Source File: DruidConfig.java    From ZTuoExchange_framework with MIT License 6 votes vote down vote up
/**
 * 注册一个StatViewServlet
 * @return
 */
@Bean
public ServletRegistrationBean DruidStatViewServlet(){
    //org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册.
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/my/druid/*");
    //添加初始化参数:initParams
    //白名单:
    servletRegistrationBean.addInitParameter("allow","127.0.0.1");
    //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
    servletRegistrationBean.addInitParameter("deny","192.168.1.73");
    //登录查看信息的账号密码.
    servletRegistrationBean.addInitParameter("loginUsername","admin");
    servletRegistrationBean.addInitParameter("loginPassword","654321");
    //是否能够重置数据.
    servletRegistrationBean.addInitParameter("resetEnable","false");
    return servletRegistrationBean;
}
 
Example #5
Source File: DruidConfiguration.java    From springBoot-study with Apache License 2.0 6 votes vote down vote up
@Bean
public ServletRegistrationBean druidStatViewServle() {
	//注册服务
	ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(
			new StatViewServlet(), "/druid/*");
	// 白名单(为空表示,所有的都可以访问,多个IP的时候用逗号隔开)
	servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
	// IP黑名单 (存在共同时,deny优先于allow) 
	servletRegistrationBean.addInitParameter("deny", "127.0.0.2");
	// 设置登录的用户名和密码
	servletRegistrationBean.addInitParameter("loginUsername", "pancm");
	servletRegistrationBean.addInitParameter("loginPassword", "123456");
	// 是否能够重置数据.
	servletRegistrationBean.addInitParameter("resetEnable", "false");
	return servletRegistrationBean;
}
 
Example #6
Source File: DruidMonitorConfigurer.java    From mySpringBoot with Apache License 2.0 6 votes vote down vote up
/**
 * 注册ServletRegistrationBean
 * @return
 */
@Bean
public ServletRegistrationBean registrationBean() {
    ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    /** 初始化参数配置,initParams**/
    //白名单多个ip逗号隔开
    bean.addInitParameter("allow", "127.0.0.1,192.168.0.102");
    //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
    bean.addInitParameter("deny", "192.168.1.110");
    //登录查看信息的账号密码.
    bean.addInitParameter("loginUsername", "admin");
    bean.addInitParameter("loginPassword", "123456");
    //是否能够重置数据.
    bean.addInitParameter("resetEnable", "false");
    return bean;
}
 
Example #7
Source File: DruidConfig.java    From kitty with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
     * 注册Servlet信息, 配置监控视图
     *
     * @return
     */
    @Bean
    @ConditionalOnMissingBean
    public ServletRegistrationBean<Servlet> druidServlet() {
        ServletRegistrationBean<Servlet> servletRegistrationBean = new ServletRegistrationBean<Servlet>(new StatViewServlet(), "/druid/*");

        //白名单:
//        servletRegistrationBean.addInitParameter("allow","127.0.0.1,139.196.87.48");
        //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
        servletRegistrationBean.addInitParameter("deny","192.168.1.119");
        //登录查看信息的账号密码, 用于登录Druid监控后台
        servletRegistrationBean.addInitParameter("loginUsername", "admin");
        servletRegistrationBean.addInitParameter("loginPassword", "admin");
        //是否能够重置数据.
        servletRegistrationBean.addInitParameter("resetEnable", "true");
        return servletRegistrationBean;

    }
 
Example #8
Source File: DruidMonitorConfigurer.java    From FlyCms with MIT License 6 votes vote down vote up
/**
 * 注册ServletRegistrationBean
 * @return
 */
@Bean
public ServletRegistrationBean registrationBean() {
    ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    /** 初始化参数配置,initParams**/
    //白名单
    bean.addInitParameter("allow", "127.0.0.1");//多个ip逗号隔开
    //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
    //bean.addInitParameter("deny", "192.168.1.110");
    //登录查看信息的账号密码.
    bean.addInitParameter("loginUsername", "admin");
    bean.addInitParameter("loginPassword", "flyCms2018");
    //是否能够重置数据.
    bean.addInitParameter("resetEnable", "false");
    return bean;
}
 
Example #9
Source File: DruidMonitorConfiguration.java    From spring-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 监控配置
 */
@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    //白名单:
    servletRegistrationBean.addInitParameter("allow", properties.getAllow());
    //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
    servletRegistrationBean.addInitParameter("deny", properties.getDeny());
    //登录查看信息的账号密码.
    servletRegistrationBean.addInitParameter("loginUsername", properties.getLoginUsername());
    servletRegistrationBean.addInitParameter("loginPassword", properties.getLoginPassword());
    //是否能够重置数据.
    servletRegistrationBean.addInitParameter("resetEnable", properties.getResetEnable());
    log.info("\n*** Initialize Druid monitor successful." + properties.getAllow());
    return servletRegistrationBean;
}
 
Example #10
Source File: DruidConfig.java    From ZTuoExchange_framework with MIT License 6 votes vote down vote up
/**
 * 注册一个StatViewServlet
 * @return
 */
@Bean
public ServletRegistrationBean DruidStatViewServlet(){
    //org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册.
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/my/druid/*");
    //添加初始化参数:initParams
    //白名单:
    servletRegistrationBean.addInitParameter("allow","127.0.0.1");
    //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
    servletRegistrationBean.addInitParameter("deny","192.168.1.73");
    //登录查看信息的账号密码.
    servletRegistrationBean.addInitParameter("loginUsername","admin");
    servletRegistrationBean.addInitParameter("loginPassword","654321");
    //是否能够重置数据.
    servletRegistrationBean.addInitParameter("resetEnable","false");
    return servletRegistrationBean;
}
 
Example #11
Source File: DuridConfig.java    From MicroCommunity with Apache License 2.0 6 votes vote down vote up
/**
 *  servlet注册
 * @return ServletRegistrationBean
 */
@Bean
public ServletRegistrationBean statViewServlet() {
    //创建servlet注册实体
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    //设置ip白名单
    servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
    //设置ip黑名单,如果allow与deny共同存在时,deny优先于allow
    //servletRegistrationBean.addInitParameter("deny","192.168.0.19");
    //设置控制台管理用户
    servletRegistrationBean.addInitParameter("loginUsername", "admin");
    servletRegistrationBean.addInitParameter("loginPassword", "123456");
    //是否可以重置数据
    servletRegistrationBean.addInitParameter("resetEnable", "false");
    return servletRegistrationBean;
}
 
Example #12
Source File: DruidConfig.java    From AthenaServing with Apache License 2.0 6 votes vote down vote up
/**
 * 注册ServletRegistrationBean
 *
 * @return
 */
@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean reg = new ServletRegistrationBean();
    reg.setServlet(new StatViewServlet());
    reg.addUrlMappings("/druid/*");
    reg.addInitParameter("loginUsername", "sctang2");
    reg.addInitParameter("loginPassword", "2017007476");
    reg.addInitParameter("allow", propUtil.IP);
    reg.addInitParameter("deny", "");
    reg.addInitParameter("resetEnable", "false");
    reg.addInitParameter("mergeSql", "true");
    reg.addInitParameter("slowSqlMillis", "10");
    reg.addInitParameter("logSlowSql", "true");
    return reg;
}
 
Example #13
Source File: DruidConfig.java    From springboot-learn with MIT License 6 votes vote down vote up
@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
    servletRegistrationBean.setServlet(new StatViewServlet());
    servletRegistrationBean.addUrlMappings("/druid/*");
    Map<String, String> initParameters = new HashMap<>();
    initParameters.put("resetEnable", "false"); //禁用HTML页面上的“Rest All”功能
    initParameters.put("allow", "");  //ip白名单(没有配置或者为空,则允许所有访问)
    initParameters.put("loginUsername", "admin");  //++监控页面登录用户名
    initParameters.put("loginPassword", "admin");  //++监控页面登录用户密码
    initParameters.put("deny", ""); //ip黑名单
    initParameters.put("slowSqlMillis", "200");//执行时间大于200毫秒的都是慢sql

    //如果某个ip同时存在,deny优先于allow
    servletRegistrationBean.setInitParameters(initParameters);
    return servletRegistrationBean;
}
 
Example #14
Source File: DruidConfiguration.java    From pmq with Apache License 2.0 6 votes vote down vote up
/**
 * 注册一个StatViewServlet
 * @return
 */
@Bean
public ServletRegistrationBean DruidStatViewServle2(){
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/druid2/*");

    //添加初始化参数:initParams
    /** 白名单,如果不配置或value为空,则允许所有 */
    servletRegistrationBean.addInitParameter("allow","");
    /** 黑名单,与白名单存在相同IP时,优先于白名单 */
    servletRegistrationBean.addInitParameter("deny","");
    /** 用户名 */
    servletRegistrationBean.addInitParameter("loginUsername",env.getProperty("spring.datasource.username", ""));
    /** 密码 */
    servletRegistrationBean.addInitParameter("loginPassword",env.getProperty("spring.datasource.password", ""));
    /** 禁用页面上的“Reset All”功能 */
    servletRegistrationBean.addInitParameter("resetEnable","false");
    return servletRegistrationBean;
}
 
Example #15
Source File: DruidConfig.java    From SpringBoot-Base-System with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 也可以通过继承StatViewServlet 使用@WebFilter实现
 * 
 * @time 2018年4月10日 下午4:59:57.
 * @version V1.0
 * @return ServletRegistrationBean
 */
@Bean
public ServletRegistrationBean statViewServle() {
	ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),
			"/druid/*");
	// 白名单:1
	servletRegistrationBean.addInitParameter("allow", "192.168.1.1,127.0.0.1");
	// IP黑名单 (存在共同时,deny优先于allow)
	// servletRegistrationBean.addInitParameter("deny", "192.168.1.100");
	// 登录查看信息的账号密码.
	// servletRegistrationBean.addInitParameter("loginUsername", "druid");
	// servletRegistrationBean.addInitParameter("loginPassword",
	// "druid123");
	// 是否能够重置数据.
	servletRegistrationBean.addInitParameter("resetEnable", "false");
	return servletRegistrationBean;
}
 
Example #16
Source File: DruidMonitorConfig.java    From spring-boot-cookbook with Apache License 2.0 6 votes vote down vote up
@Bean
    public ServletRegistrationBean servletRegistrationBean() {
/*      此servlet提供展示druid统计数据的界面。
        这个StatViewServlet的用途包括:
        提供监控信息展示的html页面
        提供监控信息的JSON API
         https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_StatViewServlet%E9%85%8D%E7%BD%AE */
        StatViewServlet servlet = new StatViewServlet();
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(servlet, "/druid/*");
//        根据配置中的url-pattern来访问内置监控页面,如果是上面的配置,内置监控页面的首页是/druid/index.html

/*      deny优先于allow,如果在deny列表中,就算在allow列表中,也会被拒绝。
        如果allow没有配置或者为空,则允许所有访问。
        由于匹配规则不支持IPV6,配置了allow或者deny之后,会导致IPV6无法访问。*/
//        registrationBean.addInitParameter(StatViewServlet.PARAM_NAME_ALLOW, "127.0.0.1,192.168.1.10/24");
//        registrationBean.addInitParameter(StatViewServlet.PARAM_NAME_DENY, "192.168.1.8");
        registrationBean.addInitParameter(StatViewServlet.PARAM_NAME_USERNAME, "admin");
        registrationBean.addInitParameter(StatViewServlet.PARAM_NAME_PASSWORD, "admin-pwd");

        //在StatViewServlet输出的html页面中,有一个功能是Reset All,执行这个操作之后,会导致所有计数器清零,重新计数。
        // 你可以通过配置参数关闭它。
        // 此处是开启这个功能
        registrationBean.addInitParameter(StatViewServlet.PARAM_NAME_RESET_ENABLE, Boolean.TRUE.toString());
        return registrationBean;
    }
 
Example #17
Source File: DruidConfiguration.java    From youkefu with Apache License 2.0 6 votes vote down vote up
/**
	 * 注册一个StatViewServlet
	 * @return
	 */
	@Bean
	public ServletRegistrationBean DruidStatViewServle2(){
		//org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册.
		ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/druid/*");
		//添加初始化参数:initParams
		//白名单:
//		servletRegistrationBean.addInitParameter("allow","127.0.0.1");
		//IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
//		servletRegistrationBean.addInitParameter("deny","192.168.1.73");
		//登录查看信息的账号密码.
		servletRegistrationBean.addInitParameter("loginUsername","admin");
		servletRegistrationBean.addInitParameter("loginPassword","123456");
		//是否能够重置数据.
		servletRegistrationBean.addInitParameter("resetEnable","false");
		return servletRegistrationBean;
	}
 
Example #18
Source File: DruidConfig.java    From springboot-shiro with MIT License 6 votes vote down vote up
@Bean
public ServletRegistrationBean druidStatViewServlet() {
    ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(), druidProperties.getServletPath());

    // IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
    List<String> denyIps = druidProperties.getDenyIps();
    if(!CollectionUtils.isEmpty(denyIps)){
        bean.addInitParameter("deny", StringUtils.collectionToDelimitedString(denyIps, ","));
    }

    // IP白名单
    List<String> allowIps = druidProperties.getAllowIps();
    if(!CollectionUtils.isEmpty(allowIps)){
        bean.addInitParameter("allow", StringUtils.collectionToDelimitedString(allowIps, ","));
    }

    // 登录查看信息的账号密码.
    bean.addInitParameter("loginUsername", druidProperties.getUsername());
    bean.addInitParameter("loginPassword", druidProperties.getPassword());
    // 禁用HTML页面上的"Reset All"功能(默认false)
    bean.addInitParameter("resetEnable", String.valueOf(druidProperties.getResetEnable()));
    return bean;
}
 
Example #19
Source File: DruidMonitorConfig.java    From spring-boot-shiro with Apache License 2.0 6 votes vote down vote up
/**
 * 注册ServletRegistrationBean
 * @return
 */
@Bean
public ServletRegistrationBean<StatViewServlet> registrationBean() {
    //org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册.
    ServletRegistrationBean<StatViewServlet> bean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
    /** 初始化参数配置,initParams**/
    //白名单
    bean.addInitParameter("allow", "127.0.0.1");//多个ip逗号隔开
    //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
    //bean.addInitParameter("deny", "192.168.1.110");
    //登录查看信息的账号密码.
    bean.addInitParameter("loginUsername", "admin");
    bean.addInitParameter("loginPassword", "123456");
    //是否能够重置数据.
    bean.addInitParameter("resetEnable", "false");
    return bean;
}
 
Example #20
Source File: DruidAutoConfig.java    From springboot-seed with MIT License 5 votes vote down vote up
@Bean
public ServletRegistrationBean DruidStatViewServle2() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    //白名单:
    servletRegistrationBean.addInitParameter("allow", properties.getAllow());
    //登录查看信息的账号密码.
    servletRegistrationBean.addInitParameter("loginUsername", properties.getUsername());
    servletRegistrationBean.addInitParameter("loginPassword", properties.getPassword());
    return servletRegistrationBean;
}
 
Example #21
Source File: WebConfig.java    From platform with Apache License 2.0 5 votes vote down vote up
/**
 * StatViewServlet
 *
 * @return {@link StatViewServlet}
 */
@Bean
@ConditionalOnWebApplication
public ServletRegistrationBean<StatViewServlet> statViewServlet() {
    ServletRegistrationBean<StatViewServlet> bean = new ServletRegistrationBean<>();
    bean.setServlet(new StatViewServlet());
    bean.addUrlMappings("/druid/*");
    return bean;
}
 
Example #22
Source File: DruidDataSourceConfig.java    From easyweb with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean druidServlet() {
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
    servletRegistrationBean.setServlet(new StatViewServlet());
    servletRegistrationBean.addUrlMappings("/druid/*");
    Map<String, String> initParameters = new HashMap<String, String>();
    // initParameters.put("loginUsername", "druid");// 用户名
    // initParameters.put("loginPassword", "druid");// 密码
    initParameters.put("resetEnable", "false");// 禁用HTML页面上的“Reset All”功能
    initParameters.put("allow", "127.0.0.1"); // IP白名单 (没有配置或者为空,则允许所有访问)
    // initParameters.put("deny", "192.168.20.38");// IP黑名单
    // (存在共同时,deny优先于allow)
    servletRegistrationBean.setInitParameters(initParameters);
    return servletRegistrationBean;
}
 
Example #23
Source File: DruidWebStatAutoConfiguration.java    From spring-boot-starter-dao with Apache License 2.0 5 votes vote down vote up
@Bean
ServletRegistrationBean servletRegistration(DruidStatProperties druidStatConfig) {
	ServletRegistrationBean filterRegistration = new ServletRegistrationBean(new StatViewServlet());
	filterRegistration.setAsyncSupported(true);
	filterRegistration.setEnabled(true);
	filterRegistration.addUrlMappings("/druid/*");
	filterRegistration.setInitParameters(druidStatParameters(druidStatConfig));
	return filterRegistration;
}
 
Example #24
Source File: EcssentDatabaseConfig.java    From maintain with MIT License 5 votes vote down vote up
@Bean
public ServletRegistrationBean druidServlet() {
	ServletRegistrationBean reg = new ServletRegistrationBean();
	reg.setServlet(new StatViewServlet());
	reg.addUrlMappings("/druid/*");
	// reg.addInitParameter("allow", "127.0.0.1");
	// reg.addInitParameter("deny","");
	reg.addInitParameter("loginUsername", "admin");
	reg.addInitParameter("loginPassword", "admin");
	return reg;
}
 
Example #25
Source File: WebConfig.java    From Guns with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * druidServlet注册
 */
@Bean
public ServletRegistrationBean druidServletRegistration() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new StatViewServlet());
    registration.addUrlMappings("/druid/*");
    return registration;
}
 
Example #26
Source File: WebConfig.java    From api-server-seed with Apache License 2.0 5 votes vote down vote up
@Bean
@Order
public ServletRegistrationBean statViewServlet() {
	StatViewServlet servlet = new StatViewServlet();
	ServletRegistrationBean bean = new ServletRegistrationBean(servlet, "/druid/*");
	return bean;
}
 
Example #27
Source File: DruidDataSourceConfiguration.java    From NetworkDisk_Storage with GNU General Public License v2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean<StatViewServlet> druidServlet() {
	ServletRegistrationBean<StatViewServlet> servletRegistrationBean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
	servletRegistrationBean.addInitParameter("allow", "");
	servletRegistrationBean.addInitParameter("deny", "192.168.1.100");
	servletRegistrationBean.addInitParameter("loginUsername", "727Pan");
	servletRegistrationBean.addInitParameter("loginPassword", "727Pan&quhailong");
	servletRegistrationBean.addInitParameter("resetEnable", "false");
	return servletRegistrationBean;
}
 
Example #28
Source File: DruidDataSourceConfiguration.java    From NetworkDisk_Storage with GNU General Public License v2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean<StatViewServlet> druidServlet() {
	ServletRegistrationBean<StatViewServlet> servletRegistrationBean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
	servletRegistrationBean.addInitParameter("allow", "");
	servletRegistrationBean.addInitParameter("deny", "192.168.1.100");
	servletRegistrationBean.addInitParameter("loginUsername", "727Pan");
	servletRegistrationBean.addInitParameter("loginPassword", "727Pan&quhailong");
	servletRegistrationBean.addInitParameter("resetEnable", "false");
	return servletRegistrationBean;
}
 
Example #29
Source File: DruidDataSourceConfiguration.java    From NetworkDisk_Storage with GNU General Public License v2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean<StatViewServlet> druidServlet() {
	ServletRegistrationBean<StatViewServlet> servletRegistrationBean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
	servletRegistrationBean.addInitParameter("allow", "");
	servletRegistrationBean.addInitParameter("deny", "192.168.1.100");
	servletRegistrationBean.addInitParameter("loginUsername", "727Pan");
	servletRegistrationBean.addInitParameter("loginPassword", "727Pan&quhailong");
	servletRegistrationBean.addInitParameter("resetEnable", "false");
	return servletRegistrationBean;
}
 
Example #30
Source File: DruidDataSourceConfiguration.java    From NetworkDisk_Storage with GNU General Public License v2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean<StatViewServlet> druidServlet() {
	ServletRegistrationBean<StatViewServlet> servletRegistrationBean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
	servletRegistrationBean.addInitParameter("allow", "");
	servletRegistrationBean.addInitParameter("deny", "192.168.1.100");
	servletRegistrationBean.addInitParameter("loginUsername", "727Pan");
	servletRegistrationBean.addInitParameter("loginPassword", "727Pan&quhailong");
	servletRegistrationBean.addInitParameter("resetEnable", "false");
	return servletRegistrationBean;
}