close

[Solved] spring.profiles.active is not working in springboot application

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error spring.profiles.active is not working in springboot application in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How spring.profiles.active is not working in springboot application Error Occurs?

Today I am facing the following error spring.profiles.active is not working in springboot application in Java.

How To Solve spring.profiles.active is not working in springboot application Error ?

  1. How To Solve spring.profiles.active is not working in springboot application Error ?

    To Solve spring.profiles.active is not working in springboot application Error 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 Solve spring.profiles.active is not working in springboot application Error 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

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}

Solution 2

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.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read