I'm developing a Spring Boot application and I have to make it run in our Weblogic 12c
server, as a war.
I try to find a way to pass the default Spring active profile (info here and here) to the application, without having to set an environment variable on the machine itself. I'd like to be able to specify this profile using the Weblogic admin console, if possible.
I tried playing with the "Environment / Servers / MyServer / Server Start / Arguments
" options, but I've been unable to make Spring load the specified profile this way. I've tried, without success :
spring.profiles.active=dev
-Dspring.profiles.active='dev'
-Dspring.profiles.active=dev
-spring.profiles.active=dev
--spring.profiles.active=dev
Any idea if it's possible to pass the spring.profiles.active
to Spring, using Weblogic? I need to pass "dev
", "acc
" or "prod
".
UPDATE : I would accept an answer explaining any easy way to have different .properties
files used for the application configurations, depending on the environment the Sprint Boot application runs on. Those .properties
files could be bundled in the application itself, or can be external. But I need to touch the system Weblogic is running on at least as possible... No environment variables and ideally no change to the Weblogic files either! Ideally, the solution would involve some kind of manipulations done using the Weblogic Admin console, for example a way to pass a parameter representing the current environment to the Spring Boot application so the correct application.[ENVIRONMENT].properties
file is used.
UPDATE 2 : One way of allowing each environment to have its own application.properties
file , is by using Deployment plans. This is probably the recommended way of doing it. I'll add that as an answer, but I'd still prefere an easier approach... I can't believe it's not possible to simply pass a parameter to an application, when it's deployed in Weblogic! And what is the "Environment / Servers / MyServer / Server Start / Arguments
option for if it can't be used for that purpose?
UPDATE 3 : Related thread. If I understand correctly, the "Environment / Servers / MyServer / Server Start / Arguments
" options may only work if a NodeManager is enabled? That would explain why I'm unable to pass that spring.profiles.active=dev
variable!