你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

SpringBoot启动时加载外部配置文件

2022/9/15 7:20:32

SpringBoot官方文档介绍:https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config

有时候相同的代码需要部署不同的环境,配置不同,每次部署都要修改配置文件代码,为了简化部署,可以在启动时指定配置文件:

 java -jar -Dspring.profiles.active=dev comment-0.0.1-SNAPSHOT.jar --spring.config.location=/home/future/application-dev.properties