1.------------------- 读取application.properties配置文件 ------------------- java
application.properties内容:spring
book.name=springboot
book.number=${random.value}
读取代码springboot
@RestController public class HelloController { @Value("${book.name}") private String name; @Value("${book.number}") private String number; @RequestMapping("/hello") public String index() { return "Hello World " + name + " " + number; } }
2. ------------------- 设置多配置文件 ------------------- app
3.------------------- 在启动时能够修改配置文件属性以下修改启动端口号,在用命令行方式启动Spring Boot 应用时, 连续的两个减号--就是对application.propertier 中的属性值进行赋值的标识。 -------------------dom
java -jar xxx.jar --server.part= 8888spa
4.------------------- actuator 可查看监控数据 ----------------------------命令行
http://127.0.0.1:8080/actuatorcode
http://127.0.0.1:8080/actuator/envserver
http://127.0.0.1:8080/actuator/metricsblog
http://127.0.0.1:8080/actuator/shutdown //优雅关闭springboot