spring.profiles.active is not working in springboot application

We Are Going To Discuss About spring.profiles.active is not working in springboot application. So lets Start this Java Article.

spring.profiles.active is not working in springboot application

  1. spring.profiles.active is not working in springboot application

    To activate a profile via annotations you need @ActiveProfile("profileName"). The @Profile annotation is used to label an object as being a member of the profile.

  2. spring.profiles.active is not working in springboot application

    To activate a profile via annotations you need @ActiveProfile("profileName"). The @Profile annotation is used to label an object as being a member of the profile.

Solution 1

To activate a profile via annotations you need @ActiveProfile("profileName"). The @Profile annotation is used to label an object as being a member of the profile.

Original Author Of This Content

Solution 2

you can also try to run the application and pass them as command line args

java -jar -Dspring.profiles.active={your_profile_name} application.jar

or if you run the app via maven:

mvn spring-boot:run -Dspring-boot.run.profiles={your_profile_name}

Here is an nice example I found on the internet with all the ways you can set the spring profile, it should help : https://www.baeldung.com/spring-profiles

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment