第2章 聊聊开发环境搭建和基本开发
2.1 搭建Spring Boot开发环境
2.2 Spring Boot的依赖和自动配置
http: //docs.spring.io/springboot/docs/current-SNAPSHOT/reference/htmlsingle/#appendix
2.3 使用自定义配置
属性文件application.properties
- 一个默认的配置文件,可以自定义配置
- 启动端口
server.port=8080
Spring Boot参数配置优先级:
- 启动端口
- 命令行参数
- 来自java:comp/env的JNDI属性
- Java系统属性(
System.getProperties()
) - 操作系统环境变量
- RandomValuePropertySource配置的random.*属性值
- jar包外部的application-{profile}.properties或application.yml(带spring.profile)配置文
- jar包内部的application-{profile}.properties或application.yml(带spring.profile)配置文件
- jar包外部的application.properties或application.yml(不带spring.profile)配置文件
- jar包内部的application.properties或application.yml(不带spring.profile)配置文件
- @Configuration注解类上的@Property Source
- 通过SpringApplication.setDefaultProperties指定的默认属性