spring - 有没有一种方法可以将属性文件包含在另一个属性文件中?

标签 spring properties spring-boot

我想避免使application.properties文件杂乱无章,这比我认为在单独的文件中更好。
application.properties应该类似于

@include module1.properties
@include module1.properties
...
###################################
######### Spring Misc #############
###################################

# Direct log to a log file
logging.file=/tmp/kmp-manager.log

#local listening port
server.port=8082

spring.profiles=nr_dev nr_testing production
spring.profiles.active=production

spring.datasource.platform=postgresql

java.security.egd=file:/dev/./urandom

这完全有可能吗?
如果没有,那么避免困惑的明智方法是什么?

最佳答案

Spring Boot Spring Boot 2.4添加了导入功能
现在,我们可以使用spring.config.import=developer.properties导入其他文件。查看此blog帖子以获取更多详细信息

关于spring - 有没有一种方法可以将属性文件包含在另一个属性文件中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39616176/

相关文章:

java - Spring Data 无法为方法创建查询

ios - 为什么使用强大的属性来保存选择器 View

tomcat部署文件后出现java.io.FileNotFoundException : src\main\resources\Report\testQuery. xlsx(系统找不到指定的路径)

mysql - 在 Spring Boot 中从单个实体创建两个表

Spring 工具套件4 : How do I turn off Spring Boot Language Server output to the console window?

java - 不允许加载本地资源: Why?

Java Spring ManyToOne 如何加载唯一引用

javascript - 如何设置JavaScript对象的属性值?

mysql - 更新 One2One 关系对象 (JPA 2)

java - 访问 Spring 3.1 应用程序 xml 中的 PropertySource