![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
springmvc
文章平均质量分 52
chenkangck50
这个作者很懒,什么都没留下…
展开
-
设计模式:springmvc适配器模式源码分析
适配器模式:基本概念适配器模式(Adapter Pattern):将某个类的接口转换成客户端期望的另一个接口,让原本因接口不匹配不能一起工作的两个类可以协同工作。其别名为包装器(Wrapper),从用户的角度看不到被适配者,用户调用适配器转化出来的目标接口方法,适配器再调用被适配者的相关接口方法;;适配器模式属于结构型模式;主要分为三类:类适配器模式、对象适配器模式、接口适配器模式;适配器的4个角色1、目标(Target)定义一个客户端使用的特定接口。2、客户端(Client)使用目标接口原创 2022-01-26 11:48:23 · 910 阅读 · 0 评论 -
spring mvc的拦截器源码分析
上面说了dispatcher servlet的执行流程源码,现在分析下拦截器的源码首先看下自己的的interceptor ,然后还需要将inerceptor注册到WebMvcConfigurer中实现package com.example.demo.config;import org.springframework.context.annotation.Configuration;import org.springframework.lang.Nullable;import org.sprin原创 2022-01-15 16:24:54 · 1013 阅读 · 0 评论 -
spring mvc的执行流程源码分析
前面介绍了http请求如何达到servlet的,下面分析下dispatcherServlet就知道spring mvc的执行流程了,还是从上面的 doDispatch开始protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Exception { HttpServletRequest processedRequest = request; HandlerExec原创 2022-01-15 16:39:33 · 130 阅读 · 0 评论 -
@ControllerAdvice源码解析
在bean 初始化后RequestMappingHandlerAdapterpublic void afterPropertiesSet() { // 初始化controllerAdvice this.initControllerAdviceCache(); List handlers; if (this.argumentResolvers == null) { handlers = this.getDefaultArgumentResolvers();原创 2022-01-18 08:38:16 · 503 阅读 · 1 评论