Friday, May 3, 2019

Spring Boot profile with maven

I share example how to add profile in spring boot with maven.

For example :

1. I add 3 profiles on pom.xml by default profile prod is active.

-local
-dev
-prod




2. Also add on pom.xml on section <build></build>



3. Add 3 file on Spring boot project src/main/resources, each file is one profile.





4. Add into application.properties



5. if you want change profile create file application.yml and write:



In the image the local is the profile active if you change, change the position the profile. the concepts is similar a pile. if you don't want to create file application.yml then into the application.properties (spring.profiles.active=prod).

that is it.












No comments:

Post a Comment

Automating Deployments with CronJobs in Google Kubernetes Engine (GKE)

In the realm of container orchestration, automation plays a pivotal role in streamlining operations. Google Kubernetes Engine (GKE) offers r...