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 }

最新文章

  1. [范例] Firemonkey 弹簧动画
  2. [C#基础]说说lock到底锁谁?
  3. Android Snackbar
  4. hdu1005 矩阵
  5. KMP,模式匹配算法
  6. 使用Calendar 将当月日历打印出来
  7. Contest20140705 testC DP
  8. c++virtual inline 是否冲突
  9. SKSpriteNode类
  10. Spoj 2713 Can you answer these queries IV 水线段树
  11. VC/MFC 在ListCtl 控件中随鼠标移动提示单元格信息
  12. React--JSX语法
  13. JSP运行过程 JSP脚本 静态动态包含 jsp指令 jsp内置对象jsp四大作用域 jsp动作元素 EL表达式 JSTL 设计模式 JSP开发模式 EL内置对象
  14. 使用Spark进行搜狗日志分析实例——map join的使用
  15. C学习笔记-一些知识
  16. NIO、BIO、AIO区别
  17. if、else、elif
  18. iOS:在cell中使用倒计时的最佳方法
  19. Tornado 中 PyMongo Motor MongoEngine 的性能测试
  20. Python发送邮件不需要发件人密码认证

热门文章

  1. moviepy AudioClip帧处理ValueError: The truth value of array with more than one element is ambiguous
  2. Python使用property函数和使用@property装饰器定义属性访问方法的异同点分析
  3. 题解-CF1401E Divide Square
  4. elasticsearch的基本了解
  5. OpenCV Error: Assertion failed (src.size == dst.size &amp;&amp; src.channels() == dst.channels()) in cvConvertScale
  6. css处理文字不换行、换行截断、溢出省略号
  7. 20201126-1 txt文件筛选与读写【】
  8. centos 7.0下安装MySQL 5.7.26
  9. JavaSE23-函数式接口&amp;Stream流
  10. 工具-Redis-使用(99.6.2)