1)springboot只会加载在springboot启动类同包以及其子包下的文件
2)使用@RestController注解(返回值是对象),Springboot默认使用json格式返回
3)
《一》yml自动提示组件
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency>
《二》yml语法: k: v
(Map) friends: {lastName: zhangsan,age: 18}
(List、Set)
pets:
- cat
- dog
- pig
行内写法
pets: [cat,dog,pig]
《三》在entries上加入@Component @ConfigurationProperties(prefic="person")
@Component @ConfigurationProperties(prefix = "person")