1.------------------- 读取application.properties配置文件 -------------------
application.properties内容:
book.name=springbootbook.number=${random.value}
读取代码
1@RestController 2public class HelloController { 3 4 @Value("${book.name}") 5 private String name; 6 7 @Value("${book.number}") 8 private String number; 9 10 @RequestMapping("/hello") 11 public String index() { 12 return "Hello World " + name + " " + number; 13 } 14}
2. ------------------- 设置多配置文件 -------------------

3.------------------- 在启动时可以修改配置文件属性如下修改启动端口号,在用命令行方式启动Spring Boot 应用时, 连续的两个减号--就是对application.propertier 中的属性值进行赋值的标识。 -------------------
java -jar xxx.jar --server.part= 8888
4.------------------- actuator 可查看监控数据 ----------------------------
http://127.0.0.1:8080/actuator
http://127.0.0.1:8080/actuator/env
http://127.0.0.1:8080/actuator/metrics
http://127.0.0.1:8080/actuator/shutdown //优雅关闭springboot