Springboot druid监控配置
Posted 梦见舟
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Springboot druid监控配置相关的知识,希望对你有一定的参考价值。
@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监控配置的主要内容,如果未能解决你的问题,请参考以下文章