摘要: 1.静态资源目录: 只要静态资源放在类路径下 /static /public /resources /MATE-INF/resources 重名规则: /MATE-INF/resources /resources /static /public 访问:当前项目根路径/+静态资源名,原理:静态映射/* 阅读全文
posted @ 2021-10-09 18:56 花生又叫二花深 阅读(37) 评论(0) 推荐(0)
摘要: 键值对来表示,数据与数据之间用逗号分隔 数字:"age" : 12 字符串:"name" : "Tom" 逻辑值:"paid" : true 对象在大括号中{ }: { "age" : 12,"name" : "Tom"} 数组在方括号中[ ]: { student:[ {"age" : 12, " 阅读全文
posted @ 2021-10-09 16:36 花生又叫二花深 阅读(31) 评论(0) 推荐(0)
摘要: controller包中 1 public class HelloControlller { 2 @Autowired 3 Person person; 4 @RequestMapping("/person") 5 public Person person() 6 { 7 return person 阅读全文
posted @ 2021-10-09 16:25 花生又叫二花深 阅读(13) 评论(0) 推荐(0)
摘要: 配置文件 1.文件类型 1.1 properties 1.2 yaml 1.2.1 适合用来做一数据为中心的配置文件 1.2.2 基本语法 key : value kv之间有空格 大小写敏感 使用缩进来表示层级关系 缩进不允许使用tab,只允许使用空格 缩进的空格数不重要,只要使用相同层级的元素左对 阅读全文
posted @ 2021-10-09 14:04 花生又叫二花深 阅读(35) 评论(0) 推荐(0)
摘要: Lombok:简化开发,自动生成Bean的get,set方法,编译时才会生成,缺点,侵入性太强,大工程最好不要使用 1.引入依赖: <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </ 阅读全文
posted @ 2021-10-09 11:45 花生又叫二花深 阅读(37) 评论(0) 推荐(0)
摘要: @SpringBootConfiguration注解是以下注解构成: @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan( excludeFilters = {@Filter( type = FilterType.CUST 阅读全文
posted @ 2021-10-09 11:32 花生又叫二花深 阅读(51) 评论(0) 推荐(0)
摘要: @Configuration 用于告诉SpringBoot这是一个配置类,它本事也是一个配置文件,配置类本身也是一个组件 属性:proxyBeanMethods = true||false 如果组件有依赖,用ture 如果组件无依赖,用false @Bean在配置类里面来对方法给容器注册组件,默认是 阅读全文
posted @ 2021-10-09 01:58 花生又叫二花深 阅读(96) 评论(0) 推荐(0)
摘要: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.4.RELEASE</version> </parent>上面的 阅读全文
posted @ 2021-10-09 00:40 花生又叫二花深 阅读(32) 评论(0) 推荐(0)