如何在深圳找到专业的企业网站建设公司,以建设一个适合win7系统的网站?

摘要:win7建设网站教程,深圳企业网站公司,正规的微信推广平台,东莞手机网站站定制开发Spring MVC简介 Spring MVC框架是以请求为驱动,围绕Servlet设计,将请求发
win7建设网站教程,深圳企业网站公司,正规的微信推广平台,东莞手机网站站定制开发Spring MVC简介 Spring MVC框架是以请求为驱动#xff0c;围绕Servlet设计#xff0c;将请求发给控制器#xff0c;然后通过模型对象#xff0c;分派器来展示请求结果视图。简单来说#xff0c;Spring MVC整合了前端请求的处理及响应。 Servlet 是运行在 Web 服务器或应用…Spring MVC简介 Spring MVC框架是以请求为驱动围绕Servlet设计将请求发给控制器然后通过模型对象分派器来展示请求结果视图。简单来说Spring MVC整合了前端请求的处理及响应。 Servlet 是运行在 Web 服务器或应用服务器上的程序它是作为来自 Web 浏览器或其他 HTTP 客户端的请求和 HTTP 服务器上的数据库或应用程序之间的中间层。 Spring MVC优缺点 Spring MVC具有以下优点 (1) 可以支持各种视图技术而不仅仅局限于JSP。 (2) 可以和 Spring 框架无缝集成这是其它 Web 框架所不具备的。 (3) 清晰的角色分配前端控制器(DispatcherServlet)请求处理器映射HandlerMapping)处理器适配器HandlerAdapter)视图解析器ViewResolver。 (4) 支持各种请求资源的映射策略支持RESTful 编程风格的请求。 (5) 采用了灵活的配置方法可以通过XML配置或注解的方式实现。 (6) Spring MVC中的Controller类是POJO纯Java对象它们的测试很容易可以用JUnit等测试框架进行测试。 (7) 可以与其他框架集成如OpenAPISwagger可以为API文档和开发者交互提供支持。 Spring MVC也存在以下缺点 (1) Spring MVC 与 Servlet API 耦合严重难以脱离容器独立运行。 (2) 与其他框架相比Spring MVC的学习曲线相对较陡峭需要花费一定的时间学习和理解其工作原理和机制。 Spring MVC执行流程简介 Spring MVC执行流程如下 (1) 用户通过浏览器将HTTP请求发送到前端控制器 DispatcherServlet (2) DispatcherServlet 收到请求后调用处理器映射器HandlerMapping。HandlerMapping根据请求url找到具体的处理器生成处理器执行链HandlerExecutionChain(包括处理器对象和处理器拦截器)并返回给DispatcherServlet。也就是说uri和controller的映射是统一放在HandlerMapping中。 (3) DispatcherServlet根据处理器Handler获取处理器适配器HandlerAdapter。 (4) HandlerAdapter处理一系列的操作如参数封装数据格式转换数据验证等操作。Spring 中的处理器的实现多变比如用户的处理器可以实现 Controller 接口或者 HttpRequestHandler 接口也可以用 RequestMapping 注解将方法作为一个处理器等这就导致 Spring MVC 无法直接执行这个处理器。所以这里需要一个处理器适配器由它去执行处理器。简言之因为Handler格式不固定的所以在处理请求时需要HandlerAdapter做适配。然后HandlerAdapter调用Handler。需要说明的是这里的Handler就是Controller。 (5) HandlerAdapter回去Handler执行结果并返回ModelAndView给DispatcherServlet。 (6) DispatcherServlet将ModelAndView传给ViewReslover视图解析器。ViewReslover解析后返回具体View (7) DispatcherServlet对View进行渲染视图即将模型数据model填充至视图中。 (8) View向浏览器返回HTTP响应。 DisPatcherServlet 前端控制器 Spring MVC核心组件。用户在浏览器输入url发起请求后首先会到达DisPatcherServlet由它来调用其他组件来配合工作的完成。DisPatcherServlet的存在大大降低了组件之间的耦合性。 HandlerMapping 处理器映射器 记录url与Handler的映射方式有注解、XML配置等。 HandlerAdapter 处理器适配器 通过HandlerAdapter对处理器进行执行这是适配器模式的应用通过扩展适配器可以对更多类型的处理器进行执行。 HandLer 处理器 也称控制器就是日常开发的Controller也即业务代码。对用户的请求进行处理。Spring用一个非常抽象的方式实现了一个控制层允许用户创建多种用途的控制器。 注意Handler是单例模式所以在多线程访问的时候可能存在线程安全问题。注意不建议使用多例模式因为随着请求的增加会频繁的创建对象。对于可能存在的多线程安全问题尽量在设计的时候将控制器定义成无状态的。如果确实需要维持状态推荐使用ThreadLocal隔离不同线程。 ViewResolver 视图解析器 ViewResolver负责解析view视图并进行渲染将Model数据填充到View将处理结果通过页面展示给用户看。 View 视图 View是一个接口实现类支持不同的View类型JSP、Freemarker等。一般情况下需要通过页面标签或者页面模板技术将模型数据通过页面展示给用户需要由程序员根据业务需求开发具体的页面。 过滤器(Filter) Spring Boot中过滤器是基于 Servlet 过滤器实现。Servlet 过滤器是可用于 Servlet 编程的 Java 类有以下目的 (1) 在客户端的请求访问后端资源之前拦截这些请求。 (2) 在服务器的响应发送回客户端之前处理这些响应。 Filter是在Servlet 2.3之后增加的新功能。过滤器是以一种组件的形式绑定到Web应用程序当中当存在多个过滤器时过滤器采用了“链式”方式处理。 Spring Boot中使用过滤器 过滤器一般用于完成通用的操作如登录验证、统一编码处理、敏感字符的过滤等。 (1) 实现Filter接口 /*** Author: courage007*/ public class CustomFilter implements Filter {private String url;/*** 可以初始化Filter在web.xml里面配置的初始化参数* filter对象只会创建一次init方法也只会执行一次。* param filterConfig* throws ServletException*/Overridepublic void init(FilterConfig filterConfig) throws ServletException {this.url filterConfig.getInitParameter(URL);System.out.println(init() method. URL is: this.url);}/*** 每一次请求资源时url匹配后会执行。* 主要的业务代码编写方法* param servletRequest* param servletResponse* param filterChain* throws IOException* throws ServletException*/Overridepublic void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {System.out.println(before doFilter() method);filterChain.doFilter(servletRequest, servletResponse);System.out.println(after doFilter() method);}/*** 在销毁Filter时自动调用 * 如果服务器是正常关闭则会执行destroy方法。只执行一次。 * 注意不是方法调用完毕后执行*/Overridepublic void destroy() {System.out.println(destroy() method );} }(2) 注册过滤器到Spring容器 完成过滤器的定义后接下来就是将过滤器自动注入到Spring容器中。 两种实现方式(a) 使用WebFilter注解ServletComponentScan注解(b)实例化FilterRegistrationBean。 (a) 使用WebFilter注解 ServletComponentScan注解 首先使用WebFilter注解标注过滤器实现。其中urlPatterns用于指明过滤器针对的url。如果一个url上存在多个过滤器还需使用指定过滤器的优先级使用Order注解、实现Ordered接口、配置文件指定优先级等 /*** Author: courage007*/ Order(1) WebFilter(filterName customFilter,urlPatterns /* ,initParams { WebInitParam(name URL, value http://localhost:8080)}) public class CustomFilter implements Filter {// 实现 }然后添加ServletComponentScan注解。这样在启动的过程中会自动扫描使用WebFiter标注的类到Spring容器。 SpringBootApplication ServletComponentScan public class SpringDemoApplication {public static void main(String[] args) {SpringApplication.run(SpringDemoApplication.class, args);} }(b) 实例化FilterRegistrationBean FilterRegistrationBean 是Spring Boot提供的接口。推荐使用这种方式使用过滤器。相比第一种方式这种方式将过滤器的使用与过滤器的定义分离有利于更好复用过滤器。 /*** Author: courage007*/ Configuration public class WebConfig {//Register FilterBeanpublic FilterRegistrationBeanCustomFilterRegisteredBySpringBootBean registerCustomFilter() {FilterRegistrationBeanCustomFilterRegisteredBySpringBootBean filterRegBean new FilterRegistrationBean();filterRegBean.setFilter(new CustomFilterRegisteredBySpringBootBean());// 指定匹配urlfilterRegBean.addUrlPatterns(/*);// 指定顺序filterRegBean.setOrder(2);return filterRegBean;} }使用过滤器处理CORS问题 过滤器支持处理CORS(Cross-Origin Resource Sharing跨源资源共享)问题示例代码如下 Component public class CORSFilter implements Filter {Overridepublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {HttpServletResponse res (HttpServletResponse) response;res.addHeader(Access-Control-Allow-Credentials, true);res.addHeader(Access-Control-Allow-Origin, *);res.addHeader(Access-Control-Allow-Methods, GET, POST, DELETE, PUT, PATCH);res.addHeader(Access-Control-Allow-Headers, Content-Type,X-CAF-Authorization-Token,sessionToken,X-TOKEN);if (((HttpServletRequest) request).getMethod().equals(OPTIONS)) {response.getWriter().println(ok);return;}chain.doFilter(request, response);}Override public void destroy() {}Override public void init(FilterConfig filterConfig) throws ServletException {} }需要说明的是过滤器只是处理跨域访问问题的一种方式Spring MVC也提供了CrossOrigin注解等方式还需根据自己的业务场景合理选择。 拦截器(Interceptor) 拦截器依赖于Spring MVC框架。在实现上基于Java的反射机制属于面向切面编程AOP的一种运用。一般简单的功能又是通用的且每个请求都要去处理的比如判断token是否失效可以使用Spring MVC的HandlerInterceptor。对于复杂的比如缓存需要高度自定义的就用Spring AOP方式处理。对于Service层更多用Spring AOPcontroller层有必要用到request和response时可以用拦截器。 拦截器(Interceptor)和过滤器(Filter)都是AOP编程思想的实现主要的不同有以下几点 (1) 实现原理不同。 Interceptor是基于java的反射机制的而Filter是基于函数回调。 (2) 使用规范不同。 Filter是Servlet规范规定的是Servlet容器支持的。而Interceptor是Spring框架规范的是Spring容器支持的。 (3) 作用范围不同。 Interceptor只能对Controller请求起作用而Filter则可以对几乎所有的请求起作用。如对其他的一些比如直接访问静态资源的请求则没办法进行拦截处理。Interceptor可以访问Controller上下文、值栈里的对象而Filter不能访问。在Controller的生命周期中Interceptor可以多次被调用而Filter只能在容器初始化时被调用一次。 (4) 使用的资源不同。 Interceptor也是一个Spring组件归Spring管理因此能使用Spring里的任何资源、对象如Service对象、数据源、事务管理等。而Filter则不能。 (5) 使用深度不同。 Filter只在Servlet前后起作用。而Interceptor能够深入到方法前后、抛出异常前后等。 Spring中开发优先使用拦截器。如果拦截器无法满足需求如非Controller场景下方法调用则再尝试使用过滤器。 Spring MVC中拦截器的使用 Spring MVC中的Interceptor拦截请求是通过HandlerInterceptor来实现的。在Spring MVC中定义一个拦截器主要有两种方式第一种方式是要实现HandlerInterceptor接口或者是其它实现了HandlerInterceptor接口的类比如HandlerInterceptorAdapter。第二种方式是实现WebRequestInterceptor接口或者其它实现了WebRequestInterceptor的类。这里以HandlerInterceptor接口为例介绍如下实现拦截器。 (1) 实现Interceptor接口 示例代码如下 /*** 自定义拦截器** Author: courage007*/ public class CustomInterceptor implements HandlerInterceptor {Overridepublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {System.out.println(previous handle);return true;}Overridepublic void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {System.out.println(post handle);}Overridepublic void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception exception) throws Exception {System.out.println(after Completion);} }自定义拦截器实现了HandlerInterceptor接口。该接口声明了三个方法 (a) preHandle预处理回调方法该方法会在控制器方法前执行。其返回值表示是否中断后续操作。当其返回值为true时表示继续向下执行如调用下一个拦截器或处理器当其返回值为false时会中断后续的所有操作包括调用下一个拦截器和控制器类中的方法执行等此时需要通过response来产生响应。 (b) postHandle后处理回调方法该方法会在控制器方法调用之后。可以通过此方法对请求域中的模型和视图做出进一步的修改。在该阶段可以通过modelAndView模型和视图对象对模型数据进行处理或对视图进行处理modelAndView也可能为null。 © afterCompletion该方法会在整个请求完成即视图渲染结束之后执行。整个请求处理完毕回调方法即在视图渲染完毕时回调如性能监控中可以在此记录结束时间并输出消耗时间还可以进行一些资源清理类似于try-catch-finally中的finally但仅调用处理器执行链中preHandle返回true的拦截器的afterCompletion。 (2) 注册已实现Interceptor接口 示例代码如下 /*** 实现WebMvcConfigurer接口** Author: courage007*/ Configuration public class CustomInterceptorConfig implements WebMvcConfigurer { /*** 重写添加拦截器方法** param registry*/Overridepublic void addInterceptors(InterceptorRegistry registry) {registry.addInterceptor(new CustomInterceptor()).addPathPatterns(/**).order(1);//指定执行顺序数值越小越优先} }多个拦截器的处理 Spring MVC支持在一个uri中定义多个拦截器。多个拦截器使用使用order接口设置优先级。多个拦截器的执行顺序基于职责链模式执行。以有两个拦截器为例拦截器中方法的先后执行顺序如下 监听器(Listener) 监听器就是一个实现特定接口的程序这个程序专门用于监听一个对象的方法调用或属性改变当被监听对象发生上述事件后监听器某个方法将立即被执行。 监听器使用 在Spring Boot 应用中监听器既可以使用Servlet容器的也可以Spring的。 Servlet提供监听器使用 Servlet中监听器是在applicationsessionrequest三个对象创建、销毁或往其中添加修改删除属性时自动执行代码的功能组件。其中application对象相关的有ServletContextListener和ServletContextAttributeListenersession对象相关的有HttpSessionListener和HttpSessionAttributeListenerrequest对象相关的有ServletRequestListener和ServletRequestAttributeListener。这里以ServletContextListener为例说明下Servlet监听器的使用。 (1) 实现ServletContextListener接口 除了实现ServletContextListener接口外还需使用WebListener标注类。 /*** Author: courage007*/ WebListener public class CustomServletRequestListener implements ServletRequestListener {Overridepublic void requestInitialized(ServletRequestEvent servletRequestEvent) {System.out.println(----------------------------请求创建);}Overridepublic void requestDestroyed(ServletRequestEvent servletRequestEvent) {System.out.println(----------------------------请求销毁);} }(2) 使用ServletComponentScan注解 在Spring Boot启动使用或在一个配置类上添加ServletComponentScan注解这样就可以将WebListener的Bean自动添加到Spring容器中。 Spring 提供监听器使用 Spring Boot事件监听的流程如下(1) 自定义事件一般是继承ApplicationEvent抽象类(2)定义事件监听器一般是实现ApplicationListener接口(3) 注册监听器启动的时候需要把监听器加入到spring容器中(4)发布事件。 (1) 自定义事件 创建一个自定义事件时只需要继承ApplicationEvent抽象类。 /*** Author: courage007*/ public class CustomSpringApplicationEvent extends ApplicationEvent {public CustomSpringApplicationEvent(Object source) {super(source);} }(2) 定义事件监听器并指定事件 定义事件监听器用于响应绑定的事件。自定义事件监听器实现ApplicationListener。 /*** Author: courage007*/ public class CustomSpringApplicationListener implements ApplicationListenerCustomSpringApplicationEvent {Overridepublic void onApplicationEvent(CustomSpringApplicationEvent customSpringApplicationEvent) {System.out.println(spring监听自定义的事件);System.out.println(customSpringApplicationEvent.getClass());} }(3) 注册事件监听器 如果需要事件监听器生效还需将事件监听器注册到Spring中。常见的事件监听器的注册方法有四种(a) SpringApplication.addListeners 添加监听器(b) 把监听器纳入到spring容器中管理© 使用context.listener.classes配置项配置(d) 使用EventListener注解。 (a) SpringApplication.addListeners 添加监听器 SpringBootApplication ServletComponentScan public class SpringDemoApplication {public static void main(String[] args) {SpringApplication application new SpringApplication(SpringDemoApplication.class);// 配置事件监听器application.addListeners(new CustomSpringApplicationListener());ConfigurableApplicationContext context application.run(args);} }(b) 把监听器纳入到Spring容器中管理 如使用Component注解将监听器注册到Spring容器中。 Component public class CustomSpringApplicationListener implements ApplicationListenerCustomSpringApplicationEvent {Overridepublic void onApplicationEvent(CustomSpringApplicationEvent customSpringApplicationEvent) {System.out.println(spring监听自定义的事件);System.out.println(customSpringApplicationEvent.getClass());} }© 使用context.listener.classes配置项 在配置文件(application.properties)中添加自定义事件监听器。 context.listener.classescom.github.courage007.springdemo.listener.CustomSpringApplicationListener(d) 使用EventListener注解 还可以在方法上面加入EventListener注解且该类需要纳入到spring容器中管理。 /*** Author: courage007*/ Component public class AnnotationEventListener {EventListenerpublic void registerCustomSpringApplicationEvent(CustomSpringApplicationEvent customSpringApplicationEvent) {System.out.println(customSpringApplicationEvent.getClass());} }(4) 发布事件 发布事件时既可直接使用ConfigurableApplicationContext实例发布也可以使用ApplicationContext实例或ApplicationEventPublisher实例发布。 SpringBootApplication ServletComponentScan public class SpringDemoApplication {public static void main(String[] args) {ConfigurableApplicationContext context SpringApplication.run(SpringDemoApplication.class, args);// 发布事件context.publishEvent(new CustomSpringApplicationEvent(new Object()));} }多个监听器执行顺序 一个事件上可能包含多个监听器有时需要保证这些监听器的执行顺序。可以使用 Order注解来标记事件的监听执行顺序对于异步的监听器只保证按顺序将监听器丢入进线程池。 监听器异步执行 默认情况监听器是同步的也就是说只有当监听器的处理方法执行完成后才会执行剩下的步骤。对于耗时很长且不影响后续业务的方法如将事件记录到数据库中可以使用异步的方式处理事件。 Async EventListener public void ApiEventListener(ApiEvent event){System.out.println(收到Api调用事件内容 {} , event.getContent()); }使用 Async 标记事件处理器为异步方法。默认情况下Spring没有开启Async使用 EnableAsync 注解使 Async 有效。如果默认的线程策略不能满足需求还需指定线程池。 Spring MVC使用 Spring MVC的控制器(Handler)是不是单例模式 是单例模式所以在多线程访问的时候可能存在线程安全问题。注意不建议使用多例模式因为随着请求的增加会频繁的创建对象。对于可能存在的多线程安全问题尽量在设计的时候将控制器定义成无状态的。如果确实需要维持状态推荐使用ThreadLocal隔离不同线程。 Spring MVC常用的注解有哪些 Controller和RestController 在Spring MVC 中可以使用Controller标记一个类的方式完成Controller的定义。此外为了简化使用还可以使用RestController注解。RestController注解相当于ResponseBody Controller合在一起的作用。 Controller注解下Controller中的方法可以返回JSP、html、JSON、XML等各种类型的数据使用ResponseBody注解后无法返回JSP、HTML等视图相关的数据只能返回JSON、XML等视图无关的数据。 简单来说如果需要返回JSON、XML等视图无关的数据如果使用Controller注解还需额外补充ResponseBody注解如果使用RestController注解则无需额外的操作。 RestController注解定义如下 Target({ElementType.TYPE}) Retention(RetentionPolicy.RUNTIME) Documented Controller ResponseBody public interface RestController {AliasFor(annotation Controller.class)String value() default ; }可以看到RestController是一个组合注解组合了Controller注解和ResponseBody注解。 RequestMapping 和 GetMapping和PostMapping和PutMapping和DeleteMapping和PatchMapping RequestMapping是一个用来处理请求地址映射的注解可用于类或方法上。用于类上表示类中的所有响应请求的方法都是以该地址作为父路径。 RequestMapping注解有六个属性下面分成三类进行说明 (1) value method value指定请求的实际地址指定的地址可以是URI Template 模式。 method指定请求的method类型GET、POST、PUT、DELETE等。 (2) consumesproduces consumes指定处理请求的提交内容类型Content-Type例如application/json, text/html。 produces指定返回的内容类型仅当request请求头中的(Accept)类型中包含该指定类型才返回。 (3) paramsheaders params指定request中必须包含某些参数值才让该方法处理该请求。 headers指定request中必须包含某些指定的header值才能让该方法处理请求。 GetMapping、PostMapping、PutMapping、DeleteMapping、PatchMapping 都是在 RequestMapping 中使用 method 属性来声明 HTTP 请求所使用的方法类型。对应关系如下 在日常的开发中推荐使用GetMapping、PostMapping、PutMapping、DeleteMapping、PatchMapping等注解除非无法满足需要再使用RequestMapping注解。 PathVariable和RequestParam PathVariable用于将URL中的值绑定到参数上。具体来说首先在RequestMapping的value中使用URI template{变量名}然后在RequestMapping注解方法的需要绑定的参数前使用PathVariable指定变量名如果变量名和参数名一致也可以不指定这样URL中的值就绑定到参数上。使用示例如下 RestController RequestMapping(/testPathVariable) public class TestPathVariable {/** URI模板指定了一个变量名为id的变量当控制器处理请求时会将 id 替换为正确的值** 若请求为 testPathVariable/user/29则uid29输出29** */GetMapping(/user/{id})public void testPathVariable(PathVariable(id) String userId) {System.out.println(userId);return;} }RequestParam注解用于将指定的请求参数赋值给方法中的形参。有三个属性 (1) value请求参数名 (2) required是否必需默认为 true即 请求中必须包含该参数如果没有包含将会抛出异常可选配置 (3) defaultValue默认值如果设置了该值required 将自动设为 false即使required设置为true可选配置 使用示例如下 RestController RequestMapping(/testRequestParam) public class TestRequestParam {GetMapping(/user)public void testRequestParam(RequestParam(valuename) String userName) {System.out.println(username);return;} }这个时候如果请求/testRequestParam/user?namefoo就可将请求参数赋值给方法中的形参。 ResponseBody ResponseBody 注解用于将Controller的方法返回的对象通过适当的HttpMessageConverter转换为指定格式后写入到Response对象的body数据区。 注意这里返回的数据不是html标签的页面而是其他某种格式的数据时如json、xml等使用 ControllerAdvice和ExceptionHandler Spring 提供了使用ControllerAdvice处理异常的方法。开发者可以通过实现一个 ControlerAdvice 类来处理控制器类抛出的所有异常。其中ExceptionHandler用来指定具体的异常类型。使用示例如下 ControllerAdvice public class GlobalExceptionHandler {ExceptionHandler(Exception.class)public ModelAndView customException(Exception e) {ModelAndView mv new ModelAndView();mv.addObject(message, e.getMessage());mv.setViewName(myerror);return mv;} }参考 https://docs.spring.io/spring-framework/docs/4.2.4.RELEASE/spring-framework-reference/html/mvc.html Spring Web MVC framework https://www.w3schools.cn/springmvc/index.html Spring MVC 教程 https://docs.spring.io/spring-framework/reference/web/webmvc.html Spring Web MVC https://blog.csdn.net/thinkwon/article/details/104397427 Spring MVC面试题 https://www.w3cschool.cn/servlet/servlet-intro.html Servlet学习网站 https://blog.csdn.net/weixin_65950231/article/details/130499706 深入了解SpringMVC框架探究其优缺点、作用以及使用方法 https://blog.csdn.net/weixin_43888891/article/details/108479214 什么是SpringMVCSpringMVC有什么优缺点 https://blog.csdn.net/fuzhongmin05/article/details/81585672 从MVC到前后端分离 https://www.jianshu.com/p/8a20c547e245 SpringMVC执行流程及工作原理 https://www.cnblogs.com/lifullmoon/p/14137467.html Spring MVC 源码分析 - HandlerAdapter 组件一之 HandlerAdapter https://www.cnblogs.com/shuaifing/p/8119664.html Controller和RestController的区别 https://zhuanlan.zhihu.com/p/168017369 说说Spring中的 RestController 和 Controller https://blog.csdn.net/demo_yo/article/details/123608034 RequestMapping 注解使用技巧完整详解 https://www.cnblogs.com/FFFFF/p/4624140.html SpringMVC三PathVariable https://www.cnblogs.com/tomingto/p/11377138.html RequestParam注解的详细介绍 https://blog.csdn.net/qq_44543508/article/details/101026720 RequestParam注解详细使用 https://www.jianshu.com/p/2dbb585ffb1c Spring Boot使用过滤器Filter https://www.jdon.com/springboot/spring-filter.html https://www.cnblogs.com/jobbible/p/17546547.html SpringBoot 如何处理 CORS 跨域 https://www.jianshu.com/p/2dbb585ffb1c Spring Boot使用过滤器Filter https://blog.csdn.net/heweimingming/article/details/79993591 spring boot 过滤器、拦截器的区别与使用 https://blog.csdn.net/cold___play/article/details/103295685 SpringMVC–拦截器的两种实现方式HandlerInterceptor、WebRequestInterceptor及拦截器的执行流程单个、多个 https://my.oschina.net/centychen/blog/3018007 SpringBoot 入坑指南之六使用过滤器或拦截器 http://www.51gjie.com/javaweb/872.html Servlet Listener监听器详解原理 https://www.jianshu.com/p/5f57f2aa5e2c Springboot事件监听 https://blog.csdn.net/m0_38075425/article/details/81164501 springboot的监听器Listener https://www.jianshu.com/p/5f57f2aa5e2c Springboot事件监听 https://blog.csdn.net/weixin_41490593/article/details/97132317 springboot中监听器使用 https://www.jianshu.com/p/dcd956169910 Spring事件监听 https://blog.csdn.net/qq_30211955/article/details/86709873 Spring Boot监听事件同步和异步使用 https://my.oschina.net/u/3245438/blog/2961234 SpringBoot 启动异步事件监听机制