Reputation: 23237
I'm using this command line in order to start my spring-boot service:
mvn clean compile -DskipTests \
spring-boot:run \
-Dspring-boot.run.arguments=--spring.profiles.active="bo,pre"
I'm using two profiles : --spring.profiles.active="bo,pre"
. As you can see from above command, I'm activating bo
and pre
profiles.
However, when my service starts i am seeing only bo
profile is active:
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.4.RELEASE)
2019-12-30 09:33:08.013 INFO... : Starting ApiApplication on psgd with PID 30578 (/home/jeusdi/projects/repositori-digital/rep-digital-api/target/classes started by jeusdi in /home/jeusdi/projects/repositori-digital/rep-digital-api)
2019-12-30 09:33:08.022 DEBUG ... : Running with Spring Boot v2.0.4.RELEASE, Spring v5.0.8.RELEASE
2019-12-30 09:33:08.027 INFO ... : The following profiles are active: bo
Any ideas?
Upvotes: 2
Views: 8709
Reputation: 2741
According to the documentation you have to add spring.profiles.include
as below.
spring.profiles.include:
- pre
Both profiles should be activated when you used below properties in application.properties
file
spring.profiles.active=pre
spring.profiles.include=bo
Or If you really want to specify active profiles as command line arguments you can use below command for multiple profiles.
mvn spring-boot:run -Dspring-boot.run.arguments=--spring.profiles.active=bo,--spring.profiles.include=pre
And if you want to add more active profiles use below command.
mvn spring-boot:run -Dspring-boot.run.arguments=--spring.profiles.active=bo,--spring.profiles.include=pre,--spring.profiles.include=another
Upvotes: 2
Reputation: 66
mvn clean compile -DskipTests spring-boot:run -Dspring-boot.run.profiles=foo,boo
Upvotes: 0
Reputation: 2850
Use this property in the command line instead: -Dspring-boot.run.profiles="bo,pre"
mvn clean compile -DskipTests spring-boot:run -Dspring-boot.run.profiles="bo,pre"
Upvotes: 3