Springboot not loading application.dev.properties file
Try adding a vm argument in the run configuration:
-Dspring.profiles.active=dev
A few issues I noticed:
@Value
property name should be aString
like@Value("${server.database.host}")
- Profile specific property files should follow
application-{profile}.properties
format, e.g.application-dev.properties
- Try passing the profile with
-D
likejava -Dspring.profiles.active=dev -jar app.jar
You are supposed to specify which profile to run with as follows:
mvn spring-boot:run -Dspring-boot.run.profiles=foo,bar
Also see documentation: https://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/run-profiles.html
If running on Eclipse or STS, then use following steps:
Right click on project -> Run As -> Run Configuration.
In the new window, select spring boot application on left side, and add details on the right and in the profile dropdown, select dev.
Click apply and run.