SpringBoot默认动态代理

  1. Spring 5.x 中 AOP 默认依旧使用 JDK 动态代理
  2. SpringBoot 2.x 开始,为了解决使用 JDK 动态代理可能导致的类型转化异常而默认使用 CGLIB。
  3. 在 SpringBoot 2.x 中,如果需要默认使用 JDK 动态代理可以通过配置项**spring.aop.proxy-target-class=false**来进行修改,@EnableAspectJAutoProxy(proxyTargetClass = true)配置已无效

惊人!Spring5 AOP 默认使用Cglib ?从现象到源码深度分析

SessionAttribute实现多页面提交

felikf/spring-mvc-wizard

不要将HttpServletRequest传递到任何异步方法中!

由于Tomcat中,Request以及Response对象都是会被循环使用的,因此这个时候也是整个Request被重置的时候。
主方法结束,Request被收回,异步方法还没执行完。就会产生问题。
偶现的MissingServletRequestParameterException,谁动了我的参数?Mr_SeaTurtle的博客-CSDN博客_org.springframework.web.bind.missingservletrequest

测试

jmeter 可以通过配置文件模拟多用户访问

通过程序生成多个用户token,导入jmeter

在linux上并发测试

SpringMVC - 图1

Model、Map、ModelMap

image.png
ModelAndView中的数据会合并 方法形参中的模型数据(如model),ModelAndView中的数据优先。

  1. @RequestMapping(value = "/mergeModel")
  2. public ModelAndView mergeModel(Model model) {
  3. model.addAttribute("a", "a");//①添加模型数据
  4. ModelAndView mv = new ModelAndView("success");
  5. mv.addObject("a", "update");//②在视图渲染之前更新③处同名模型数据
  6. model.addAttribute("a", "new");//③修改①处同名模型数据
  7. //视图页面的a将显示为"update" 而不是"new"
  8. return mv;
  9. }

SpringMVC强大的数据绑定(1)——第六章 注解式控制器详解——跟着开涛学SpringMVC - 《亿级流量网站架构核心技术》~ - ITeye博客