0

I want to set spring active profile in weblogic settings. I have three properties in src/main/resources. For examp : application-dev.properties , application-qa.properties , application-test.properties.

I dont want to keep spring.profiles.active property in my application.properties file. As I have to change it every time whenever I want to deploy in different server.

I want to active the profile in weblogic (my deploying server for application). Whats is the way and how to fetch the value in springboot application?

Thanks

2 Answers2

0

Pass the profile as java argument -Dspring.profiles.active=dev

Sagar
  • 61
  • 9
  • Thanks. after setting -Dspring.profiles.active in weblogic classpath how to get the value in java app? through @value? – madhurima sarkar Apr 26 '21 at 02:13
  • under normal circumstances you would not have to do that, but if you must hen you can use @value more details at https://spring.io/blog/2020/04/23/spring-tips-configuration – Sagar Apr 27 '21 at 19:55
0

A secure way to set profiles in springboot applications is to set environment variables with it. In general, it is a good approach, so you can define it differently for each one of your environments (dev, qa and prod).

Please check this discussion, which explains specifically about Weblogic. In java, you need the SPRING_PROFILES_ACTIVE environment variable set.