码迷,mamicode.com
首页 > 编程语言 > 详细

Springboot druid监控配置

时间:2018-05-26 10:41:18      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:new   array   ash   source   监控   bst   uid   login   arrays   

@Configuration
public class DataSourceConfig {

    @Bean
    public ServletRegistrationBean statViewServlet(){
        ServletRegistrationBean bean =  new ServletRegistrationBean(new StatViewServlet(),"/druid/*");
        Map<String, String> initMap = new HashMap<>();
        initMap.put(StatViewServlet.PARAM_NAME_JMX_USERNAME,"admin");
        initMap.put(StatViewServlet.PARAM_NAME_JMX_PASSWORD,"123456");
        initMap.put("loginUsername", "admin");
        initMap.put("loginPassword", "123456");

        bean.setInitParameters(initMap);
        return bean;
    }

    @Bean
    public FilterRegistrationBean webStatFilter(){
        FilterRegistrationBean bean = new FilterRegistrationBean();
        bean.setFilter(new WebStatFilter());
        Map<String, String> initMap = new HashMap<>();
        bean.setInitParameters(initMap);
        bean.setUrlPatterns(Arrays.asList("/*"));
        return bean;
    }
}

 

Springboot druid监控配置

标签:new   array   ash   source   监控   bst   uid   login   arrays   

原文地址:https://www.cnblogs.com/mengjianzhou/p/9091569.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!