# spring-boot

# spring-boot工程

spring-boot 练手github地址

# application.yml 配置

## 端口
server.port: 1111
## 禁止缓存
spring.thymeleaf.cache: false
## 设置环境
## springBoot的约定,在resources下建立配置文件,命名规则:application-(你需要的名字)
## dev:开发环境
## test: 测试环境
## prod: 生产环境
spring.profiles.active: prod
1
2
3
4
5
6
7
8
9
10

# 注解

  • @RestController: 配在类上,相当于@ResponseBody + @Controller合在一起的作用
  • @Value("${web.domain-name}"): 配在属性上,读取application.yml配置
  • @ConfigurationProperties(prefix="confName"): 配在类上,指定读取配置
  • @component: 配在类上,把普通pojo实例化到spring容器中,相当于配置文件中的
Last Updated: 3/5/2019, 5:48:16 PM