Use: --spring.config.name=myproject
,
where myproject
is the name of the *.yml
or *.properties
file that is stored under the default /config
directory.
The extension is not required.
Further Documentation
https://www.baeldung.com/spring-yaml https://baeldung-cn.com/spring-yaml-vs-properties
need:
spring.config.activate.on-profile: “profile_name”
example:
spring: # default config without profile name
.
.
.
---
spring:
config:
activate:
on-profile: "profile name"
In conjunction with: ./gradlew run --args='--spring.profiles.active=profile_name'
Can make this even more complicated when activating multiple profiles at once with overlapping properties, in that case the precedence order of profiles needs to be defined.
From IntelliJ
Add the following as an environment variable when right clicking on the configuration in the top-left corner: spring.profiles.active=profile_name