
spring学习
spring、spring boot、spring cloud
周虽旧邦其命维新
剑气纵横三万里 一剑光寒十九洲
展开
-
springboot笔记七自定义场景启动器starter
一、创建场景启动器项目1.创建一个空project2.在空project中添加maven模块mock-spring-boot-starter3.在空project中添加spring Initialirz模块mock-spring-boot-starter-autoconfigure4.在mock-spring-boot-starter添加自动配置依赖mock-spring-boot-starter-autoconfigure5.移除mock-spring-boot-starter-autoconf原创 2021-05-11 13:53:14 · 305 阅读 · 0 评论 -
springboot笔记六内容协商
上接springboot笔记五返回值处理,RequestResponseBodyMethodProcessor处理返回值,进入writeWithMessageConverters使用消息转换器进行写出。内容协商protected <T> void writeWithMessageConverters(@Nullable T value, MethodParameter returnType, ServletServerHttpRequest inputMessage, ServletS原创 2021-04-23 12:49:15 · 243 阅读 · 0 评论 -
springboot笔记五:返回值处理
在springboot笔记三中提到在执行目标方法前,先为目标方法设置参数解析器和返回值处理器protected ModelAndView invokeHandlerMethod(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) throws Exception { ServletWebRequest webRequest = new ServletWebRequest(r原创 2021-04-09 23:00:48 · 636 阅读 · 0 评论 -
springboot笔记四:自定义Converter
通过springboot笔记三,我们已经学到自定义类型的参数是通过参数解析器ServletModelAttributeMethodProcessor创建WebDataBinder(web数据绑定器)进行参数封装,WebDataBinder属性ConversionService中有124个converters,我们也可以添加自定义Converter通过WebMvcConfigurer 定制化springmvc的功能package com.test.study.config;import com.tes原创 2021-04-04 18:09:36 · 867 阅读 · 1 评论 -
springboot笔记一:实用注解和Rest风格原理
RestController在controller类上使用@RestController注解后,不需要在方法上再写@ResponsebodyConfiguration(Full、Lite)在springboot2中使用@Configuration定义配置类,proxyBeanMethods默认true,Full模式,保证配置类的方法每次调用返回的对象是同一个,如果修改成false,Lite模式,配置类的方法每次调用返回的对象不同,Full模式用来解决组件依赖问题,如果组件只是单纯注册,没有其他组件要原创 2021-03-30 20:33:18 · 290 阅读 · 3 评论 -
springboot笔记二:请求处理流程
请求首先进入DispatcherServlet的doService方法protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception { ... request.setAttribute(WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.getWebApplicationContext());原创 2021-03-31 10:15:54 · 627 阅读 · 0 评论 -
springboot笔记三:参数解析原理
接着上一篇笔记"springboot笔记二:请求处理流程",我们从handlerMapping中找到了处理request的handler // Determine handler for the current request. mappedHandler = getHandler(processedRequest); if (mappedHandler == null) { noHandlerFound(processedRequest, response);原创 2021-03-31 15:15:03 · 511 阅读 · 0 评论