SpringBoot默认动态代理
- Spring 5.x 中 AOP 默认依旧使用 JDK 动态代理。
- SpringBoot 2.x 开始,为了解决使用 JDK 动态代理可能导致的类型转化异常而默认使用 CGLIB。
- 在 SpringBoot 2.x 中,如果需要默认使用 JDK 动态代理可以通过配置项
**spring.aop.proxy-target-class=false**
来进行修改,@EnableAspectJAutoProxy(proxyTargetClass = true)配置已无效。
惊人!Spring5 AOP 默认使用Cglib ?从现象到源码深度分析
SessionAttribute实现多页面提交
不要将HttpServletRequest传递到任何异步方法中!
由于Tomcat中,Request以及Response对象都是会被循环使用的,因此这个时候也是整个Request被重置的时候。
主方法结束,Request被收回,异步方法还没执行完。就会产生问题。
偶现的MissingServletRequestParameterException,谁动了我的参数?Mr_SeaTurtle的博客-CSDN博客_org.springframework.web.bind.missingservletrequest
测试
jmeter 可以通过配置文件模拟多用户访问
在linux上并发测试
Model、Map、ModelMap
ModelAndView中的数据会合并 方法形参中的模型数据(如model),ModelAndView中的数据优先。
@RequestMapping(value = "/mergeModel")
public ModelAndView mergeModel(Model model) {
model.addAttribute("a", "a");//①添加模型数据
ModelAndView mv = new ModelAndView("success");
mv.addObject("a", "update");//②在视图渲染之前更新③处同名模型数据
model.addAttribute("a", "new");//③修改①处同名模型数据
//视图页面的a将显示为"update" 而不是"new"
return mv;
}
SpringMVC强大的数据绑定(1)——第六章 注解式控制器详解——跟着开涛学SpringMVC - 《亿级流量网站架构核心技术》~ - ITeye博客