-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDruidConfig.java
More file actions
46 lines (43 loc) · 1.69 KB
/
DruidConfig.java
File metadata and controls
46 lines (43 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.sh.config;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 把今天最好的表现当作明天最新的起点..~
* いま 最高の表現 として 明日最新の始発..~
* Today the best performance as tomorrow newest starter!
* Created by IntelliJ IDEA.
* <p>
* author: xiaomo
* github: https://github.com/syoubaku
* email: hupengbest@163.com
* QQ_NO: 83387856
* Date: 2017/2/28 下午4:25
* Description:
* Copyright(©) 2017 by xiaomo.
**/
@Configuration
public class DruidConfig {
@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;
}
@Bean
public FilterRegistrationBean filterRegistrationBean() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(new WebStatFilter());
filterRegistrationBean.addUrlPatterns("/*");
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
return filterRegistrationBean;
}
}