摘要: 1) 创建类 并实现 HandlerInterceptor 接口, 重写接口三个方法,具体方法执行时机见代码注释 2)配置拦截器 , 一般具体配置参数使用配置文件的方式配置 阅读全文
posted @ 2018-07-13 15:28 陈先生的小板凳 阅读(3617) 评论(0) 推荐(0) 编辑
摘要: package com.cx.springboot.mylistener; import org.springframework.boot.context.event.ApplicationReadyEvent;import org.springframework.context.Applicati 阅读全文
posted @ 2018-07-13 14:29 陈先生的小板凳 阅读(391) 评论(0) 推荐(0) 编辑
摘要: 1) 创建类 实现 Filter 接口, 注意是import javax.servlet.Filter; 包下的Filter 2) 实现接口的三个方法 //容器销毁时调用 public void destroy() {} //url被拦截时调用,处理业务逻辑 public void doFilter 阅读全文
posted @ 2018-07-13 14:10 陈先生的小板凳 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 1)模拟mvc测试,和基础测试是一样的, 都需要在pom文件中引入junit的支持。 略 2)编写测试类 Application1TestMVC 在类头上除啦加入之前的@RunWith(SpringRunner.class)、@RunWith(SpringRunner.class) 之外还要加入新的 阅读全文
posted @ 2018-07-13 13:48 陈先生的小板凳 阅读(3132) 评论(0) 推荐(0) 编辑
摘要: 1)在pom文件中加入junit支持 2)新建测试类 Application1Test 在class 头上增加注解 @RunWith(SpringRunner.class) :指定运行平台,点进去 SpringRunner.class 可以看到他是集成自 SpringJUnit4ClassRunne 阅读全文
posted @ 2018-07-13 11:29 陈先生的小板凳 阅读(533) 评论(0) 推荐(0) 编辑