My Spring boot application is started from the command line with the following parameters
--spring.profiles.active=dev
Two property files are located in the resource folder :
application.properties
application_dev.properties
In my application I have a Spring Component which reads from the property file using the following
@Value("${ch.admin.host}")
private String remoteHost;
The problem is that the value of the default property file (application.properties) is assigned to the variable remoteHost, and not the value of the property file application_dev.properties
您应该将文件更改为application-dev.properties。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.