小编LEN*_*ENS的帖子

如何在 Spring Boot 应用程序中使用命令行参数读取自定义属性文件

在启动我的 Spring Boot 应用程序时,我想使用命令行参数设置自定义配置文件路径,例如:

java -jar some.jar -DConfigPath=conf/config.local(or conf/config.prod) 
Run Code Online (Sandbox Code Playgroud)

那么如何读取这个文件来生成一个spring配置呢?我可以@PropertySource以某种“动态”方式使用注释吗?

spring configuration-files spring-boot

1
推荐指数
1
解决办法
4031
查看次数

标签 统计

configuration-files ×1

spring ×1

spring-boot ×1