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

Virtual Threads in Java 21: Simplified Concurrency for Modern Applications

  With Java 21, Virtual Threads have redefined how we approach concurrency, offering a lightweight and efficient way to handle parallel and ...