druid监控
2024-09-06 02:19:37
1 @ConfigurationProperties(prefix = "spring.datasource")
2 @Bean
3 public DataSource druidDataSource(){
4 return new DruidDataSource();
5 }
6
7 //后台监控功能
8 @Bean
9 public ServletRegistrationBean statViewServlet(){
10 ServletRegistrationBean<StatViewServlet> bean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
11 //后台需要有人登陆,账号密码配置
12 HashMap<String,String> map=new HashMap<>();
13 map.put("loginUsername","admin");
14 map.put("loginPassword","123456");//key是固定的
15 //运行谁去访问
16 map.put("allow","");
17
18 bean.setInitParameters(map);
19 return bean;
20 }
拦截器
1 @Bean
2 public FilterRegistrationBean webStatFilter(){
3 FilterRegistrationBean<Filter> bean = new FilterRegistrationBean<>();
4 bean.setFilter(new WebStatFilter());
5 Map<String, String> map=new HashMap<>();
6 //这些东西不进行过滤
7 map.put("exclusions","*.js,*.css,/druid/*");
8 //可以过滤那些请求
9 bean.setInitParameters(map);
10 return bean;
11 }
最新文章
- [范例] Firemonkey 弹簧动画
- [C#基础]说说lock到底锁谁?
- Android Snackbar
- hdu1005 矩阵
- KMP,模式匹配算法
- 使用Calendar 将当月日历打印出来
- Contest20140705 testC DP
- c++virtual inline 是否冲突
- SKSpriteNode类
- Spoj 2713 Can you answer these queries IV 水线段树
- VC/MFC 在ListCtl 控件中随鼠标移动提示单元格信息
- React--JSX语法
- JSP运行过程 JSP脚本 静态动态包含 jsp指令 jsp内置对象jsp四大作用域 jsp动作元素 EL表达式 JSTL 设计模式 JSP开发模式 EL内置对象
- 使用Spark进行搜狗日志分析实例——map join的使用
- C学习笔记-一些知识
- NIO、BIO、AIO区别
- if、else、elif
- iOS:在cell中使用倒计时的最佳方法
- Tornado 中 PyMongo Motor MongoEngine 的性能测试
- Python发送邮件不需要发件人密码认证
热门文章
- moviepy AudioClip帧处理ValueError: The truth value of array with more than one element is ambiguous
- Python使用property函数和使用@property装饰器定义属性访问方法的异同点分析
- 题解-CF1401E Divide Square
- elasticsearch的基本了解
- OpenCV Error: Assertion failed (src.size == dst.size &;&; src.channels() == dst.channels()) in cvConvertScale
- css处理文字不换行、换行截断、溢出省略号
- 20201126-1 txt文件筛选与读写【】
- centos 7.0下安装MySQL 5.7.26
- JavaSE23-函数式接口&;Stream流
- 工具-Redis-使用(99.6.2)