摘要:
1.开发步骤: 1. 修改test-profiles.yml 2. 修改启动类 指定配置文件路径:spring.config.location=classpath:/test-profiles.yml @SpringBootApplication public class TestProfiles 阅读全文
摘要:
1.开发步骤: 1. 修改my-config.properties 2. 修改启动类 指定配置文件路径:spring.config.location=classpath:/test-folder/my-config.properties public static void main(String[ 阅读全文
摘要:
Spring Boot 会按顺序读取各种配置,例如命令行参数、系统参数等,本章只讲述配置文件的参数读取。默认情况下,Spring Boot 会按顺序到以下目录读取 application.properties 或者 application.yml 文件: 1. 项目根目录的 config 目录。 2 阅读全文
摘要:
1.开发环境: 1. JDK 1.8 2. IntelliJ IDEA 2.开发步骤: 1. 在2.1代码基础上新建 MyController.java @RestController public class MyController { @GetMapping("/hello") @Respon 阅读全文
摘要:
1.开发环境: 1. JDK 1.8 2. IntelliJ IDEA 2.开发步骤: 1. IDEA 中 新建Maven项目 2. pom.xml 添加依赖 spring-boot-starter-web <dependencies> <dependency> <groupId>org.sprin 阅读全文