spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.14k stars 37.95k forks source link

Specifying 'spring.profiles.active' in JNDI should not consider 'spring.profiles.default' #33236

Closed powerbroker closed 1 month ago

powerbroker commented 1 month ago

enable 'FINE' logging level of Spring.

  1. Specify following in Tomcat context.xml

<Environment name="spring.profiles.active" value="web" type="java.lang.String" override="false"/>

start web-app with Spring(6.1.11) and enjoy

Looking up JNDI object with name [java:comp/env/spring.profiles.default] ...

message series.

  1. Add following to context.xml

<Environment name="spring.profiles.default" value="web" type="java.lang.String" override="false"/>

start web-app and enjoy 'Activating profiles [web]' in your log.

The 'spring.profiles.active' value must be used when set, ignoring the 'spring.profiles.default' one. The 'spring.profiles.default' value must take part when no 'spring.profiles.active' specified.

snicoll commented 1 month ago

The 'spring.profiles.active' value must be used when set, ignoring the 'spring.profiles.default' one. The 'spring.profiles.default' value must take part when no 'spring.profiles.active' specified.

Yes, that's the expected behavior. In other words what you've stated is what should be happening. You're claiming it does not but XML snippet in text like that aren't really actionable as it doesn't make a working sample. Also the active and the default profiles have the same value so I am not sure what you're trying to do.

You could start by ignoring JNDI altogether and do the same thing in properties and validate that it works. If it does, then we're back on potentially a JNDI-specific problem and we'll need a small sample that demonstrates the problem we can run ourselves. You can attach a zip to this issue or push the code to a separate GitHub repository.

spring-projects-issues commented 1 month ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues commented 1 month ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.