面试突击75:SpringBoot 有几种读取配置文件的方法?
2022-08-17
阅读 5 分钟
1.4kSpring Boot 中读取配置文件有以下 5 种方法:使用 @Value 读取配置文件。使用 @ConfigurationProperties 读取配置文件。使用 Environment 读取配置文件。使用 @PropertySource 读取配置文件。使用原生方式读取配置文件。它们的具体使用方法如下,为了方便测试,我们在 Spring Boot 配置文件 application.properties 添...