摘要: 1.@RequestMapping国际惯例先介绍什么是@RequestMapping,@RequestMapping 是一个用来处理请求地址映射的注解,可用于类或方法上。用于类上,表示类中的所有响应请求的方法都是以该地址作为父路径;用于方法上,表示在类的父路径下追加方法上注解中的地址将会访问到该方法 阅读全文
posted @ 2022-01-23 21:46 qwedfrgh 阅读(29) 评论(0) 推荐(0)
摘要: springmvc和springboot中常用的注解有: @PathVariable 路径变量@RequestHeader 获取请求头@RequestParam 获取请求参数(指问号后的参数,url?a=1&b=2)@CookieValue 获取Cookie值@RequestAttribute 获取 阅读全文
posted @ 2022-01-23 21:45 qwedfrgh 阅读(182) 评论(0) 推荐(0)
摘要: 原先的requestmapping以及拓展的 @GetMapping @PostMapping @PutMapping 等价于(@RequestMapping(value = "xxx",method = RequestMethod.PUT)) @DeleteMapping 等价于(@Request 阅读全文
posted @ 2022-01-22 22:36 qwedfrgh 阅读(99) 评论(0) 推荐(0)
摘要: 1.springboot欢迎页 1.静态资源路径下有 index.html(但是目前如果你配置了静态资源的前缀,这种方法就不生效了) 2.controller 有处理 /index的 2.自定义Favicon 访问网站的小图标 将小图标文件改名为favicon.ico并放在静态资源路径下即可 阅读全文
posted @ 2022-01-22 22:04 qwedfrgh 阅读(130) 评论(0) 推荐(0)
摘要: 1.静态资源访问 静态资源目录 只要静态资源(图片,js,html等)放在类路径下: /static (or /public or /resources or /META-INF/resources) 访问 : 当前项目根路径/ + 静态资源名 1.原理: 静态映射 /** 。 请求进来,先去找Co 阅读全文
posted @ 2022-01-21 22:56 qwedfrgh 阅读(59) 评论(0) 推荐(0)
摘要: 1.devtools:引入可以实现静态页更新。改了代码直接 buile project 快捷键(ctrl+F9)就可以啦不需要重启应用了。 <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifac 阅读全文
posted @ 2022-01-18 22:45 qwedfrgh 阅读(72) 评论(0) 推荐(0)
摘要: 总结: SpringBoot先加载所有的自动配置类 xxxxxAutoConfiguration 每个自动配置类按照条件进行生效,默认都会绑定配置文件指定的值。(xxxxProperties里面读取,xxxProperties和配置文件进行了绑定) 生效的配置类就会给容器中装配很多组件 只要容器中有 阅读全文
posted @ 2022-01-17 22:50 qwedfrgh 阅读(46) 评论(0) 推荐(0)
摘要: 基本语法 key: value;kv之间有空格 大小写敏感 使用缩进表示层级关系 缩进不允许使用tab,只允许空格 缩进的空格数不重要,只要相同层级的元素左对齐即可 '#'表示注释 字符串无需加引号,如果要加,单引号’’、双引号""表示字符串内容会被 转义、不转义 基本写法 键值对:k v 对象: 阅读全文
posted @ 2022-01-16 18:59 qwedfrgh 阅读(57) 评论(0) 推荐(1)
摘要: @Configuration Full模式与Lite模式 package com.chen.demo1.config; import com.chen.demo1.pojo.Pet; import com.chen.demo1.pojo.User; import org.springframewor 阅读全文
posted @ 2022-01-16 15:33 qwedfrgh 阅读(29) 评论(0) 推荐(0)
摘要: 特性一:依赖管理 1.父项目做依赖管理 依赖管理 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.4.RELEA 阅读全文
posted @ 2022-01-12 23:19 qwedfrgh 阅读(88) 评论(0) 推荐(0)