文章分类 -  SpringBoot 笔记

摘要:后端 package com.atguigu.boot.config; import com.atguigu.boot.pojo.Pet; import org.springframework.context.annotation.Bean; import org.springframework.c 阅读全文
posted @ 2023-05-02 14:36 君子键 阅读(29) 评论(0) 推荐(0) 编辑
摘要:源码 循环找到处理器 HandlerMethodArgumentResolverComposite -> getArgumentResolver 找处理器原理 ModelAttributeMethodProcessor -> supportsParameter BeanUtils -> isSimp 阅读全文
posted @ 2023-05-02 13:46 君子键 阅读(21) 评论(0) 推荐(0) 编辑
摘要:复杂参数 Map、Model(map、model里面的数据会被放在request的请求域,相当于调用了 request.setAttribute)、Errors/BindingResult、RedirectAttributes(重定向携带数据)、ServletResponse(response)、S 阅读全文
posted @ 2023-04-05 17:09 君子键 阅读(145) 评论(0) 推荐(0) 编辑
摘要:Servlet API WebRequest、ServletRequest、MultipartRequest、HttpSession、javax.servlet.http.PushBuilder、Principal、InputSteam、Reader、HttpMethod、Locale、TimeZo 阅读全文
posted @ 2023-04-05 11:47 君子键 阅读(36) 评论(0) 推荐(0) 编辑
摘要:HandlerMapping 中找到能处理请求的 Handler(Controller.method()) 为当前 Handler 找一个适配器 HandlerAdapter(如:RequestMappingHandlerAdapter) 1. HandlerAdapter 0 - 支持方法上标注 阅读全文
posted @ 2023-01-08 17:17 君子键 阅读(30) 评论(0) 推荐(0) 编辑
摘要:@GetMapping("/cars/{path}") public Map<String, Object> carsSell(@MatrixVariable("low") Integer low, @MatrixVariable("brand") List<String> brand, @Path 阅读全文
posted @ 2023-01-02 18:15 君子键 阅读(25) 评论(0) 推荐(0) 编辑
摘要:@RequestAttribute(获取 request 域属性) package com.atguigu.boot.controller; import org.springframework.stereotype.Controller; import org.springframework.we 阅读全文
posted @ 2023-01-02 12:03 君子键 阅读(324) 评论(0) 推荐(0) 编辑
摘要:@PathVariable(路径变量) @RequestHeader(获取请求头) @RequestParam(获取请求参数) @CookieValue(获取 cookie 值) @RequestBody(获取请求体【只有 POST 有】) @GetMapping("/car/{id}/owner/ 阅读全文
posted @ 2023-01-02 11:20 君子键 阅读(28) 评论(0) 推荐(0) 编辑
摘要:SpringMVC 功能分析都从 DispatcherServlet 的 doDispatch 方法开始 protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Except 阅读全文
posted @ 2023-01-02 10:13 君子键 阅读(17) 评论(0) 推荐(0) 编辑
摘要:package com.atguigu.boot.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; impo 阅读全文
posted @ 2023-01-01 20:30 君子键 阅读(16) 评论(0) 推荐(0) 编辑
摘要:1. 请求参数处理 1.1 请求映射 Rest 风格支持(使用 HTTP 请求方式动词来表示对资源的操作) 以前:/getUser 获取用户 /deleteUser 删除用户 /editUser 修改用户 /saveUser 保存用户 现在:/user GET-获取用户 DELETE-删除用户 PU 阅读全文
posted @ 2023-01-01 20:11 君子键 阅读(24) 评论(0) 推荐(0) 编辑
摘要:1. 静态资源配置原理 SpringBoot 启动默认加载 xxxAutoConfiguration 类(自动配置类) SpringMVC 功能的自动配置类 WebMvcAutoConfiguration,根据 @Conditional 判断是否生效 @AutoConfiguration( afte 阅读全文
posted @ 2023-01-01 09:34 君子键 阅读(24) 评论(0) 推荐(0) 编辑
摘要:1. 欢迎页 1.1 静态资源 静态资源路径下 index.html,可以配置静态资源路径,但是不可以配置静态资源的访问前缀,否则导致 index.html 不能被默认访问。 spring: # mvc: # static-path-pattern: /res/** web: resources: 阅读全文
posted @ 2022-12-31 14:20 君子键 阅读(157) 评论(0) 推荐(0) 编辑
摘要:1. 静态资源 参考:https://docs.spring.io/spring-boot/docs/2.7.7/reference/html/web.html#web.servlet.spring-mvc.static-content 1.1 基础用法 类路径下:/static (or /publ 阅读全文
posted @ 2022-12-31 11:29 君子键 阅读(24) 评论(0) 推荐(0) 编辑
摘要:1. 添加依赖方式 参考:https://docs.spring.io/spring-boot/docs/2.7.7/reference/html/configuration-metadata.html#appendix.configuration-metadata.annotation-proce 阅读全文
posted @ 2022-12-31 09:33 君子键 阅读(37) 评论(0) 推荐(0) 编辑
摘要:1. 数据类型 字面量:单个的、不可分割的值。date、boolean、string、number、null k: v 对象:键值对的集合。map、hash、set、object k: {k1:v1,k2:v2,k3:v3} k: k1: v1 k2: v2 k3: v3 数组:一组按次序排列的值。 阅读全文
posted @ 2022-12-11 18:28 君子键 阅读(33) 评论(0) 推荐(0) 编辑
摘要:1. dev-tools <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </depend 阅读全文
posted @ 2022-12-11 17:15 君子键 阅读(9) 评论(0) 推荐(0) 编辑
摘要:简化 JavaBean 开发 <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> 日志 @Slf4j package com.atguigu.boot.cont 阅读全文
posted @ 2022-12-11 16:49 君子键 阅读(26) 评论(0) 推荐(0) 编辑
摘要:1. 过程 引入场景依赖 https://docs.spring.io/spring-boot/docs/2.7.6/reference/html/using.html#using.build-systems.starters 查看自动配置了哪些(选做) 自己分析,引入场景的自动配置一般都生效了 配 阅读全文
posted @ 2022-12-11 16:24 君子键 阅读(20) 评论(0) 推荐(0) 编辑
摘要:一、源码 1. DispatcherServletAutoConfiguration.java 给文件中加入了文件上传解析器 @Bean @ConditionalOnBean({MultipartResolver.class}) // 容器中有这个类型组件 @ConditionalOnMissing 阅读全文
posted @ 2022-12-11 15:48 君子键 阅读(69) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示