In my application yml, I have two profiles which I need to both run
spring:
profiles:
active:
awss3, @env@
application:
name: CONFIG-SERVICE
I need awss3 to be run, in what ever the env is. Is this possible ?
CodePudding user response:
In my opinion, your requirements fits Profile Groups. This approach is preferable as it allows you to visually inform the developer which profiles are required for which environments.
Example:
spring:
profiles:
group:
production:
- "aws3"
- "prodmq"
Then you can start the application using:
--spring.profiles.active=production
to active the production, aws3
and prodmq
profiles in one hit.
To clarify: The keyword production
under group: is what you will use when you run your application as spring.profiles.active=production
Alternatively like you can simply add whatever profiles you want from the command line.
java -jar -Dspring.profiles.active=awss3,prodmq demo-0.0.1-SNAPSHOT.jar
CodePudding user response:
yes, using properties:
// Use your dynamic profile
spring.profiles.active=@env@
// Include your default profile
spring.profiles.include=awss3
yaml:
spring:
profiles:
include: awss3
active:
@env@