I would like to read my profile from an external resource. I have 2 environments one for prod and one for dev. I want my dev env to always load with the dev profile without the need to change the property in the application.properties since it will change in git too if someone pushes this change.
I want each machine to load the profile from external file thus eliminating the need to change application.properties each time someone changes it.
I created a file called profile.properties which is not visible by git and added this line:
spring.profiles.active=test
Then I annotated my class with @PropertySource("classpath:profile.properties") but when I run it I get that the profile is set to default.
I saw the answer here spring-boot-profiles-with-external-properties but still I am not sure how I can read the profile "dev" (as mentioned there) from an external resource.