• Andy Wilkinson's avatar
    Make servlet context property source available before refresh · 858b092a
    Andy Wilkinson authored
    Previously, when deploying a Spring Boot application to a container,
    the servlet context property source was not fully initialised until
    the context was refreshed. This led to a problem where a value from a
    property source with lower precedence would be seen during the early
    stages of the application starting. Once the servlet context property
    source had been initialized, its value for the property would then
    become visible effectively making it appear as if the property's
    value had changed during startup. This led to a specific problem
    with determining active profiles.
    
    If spring.profiles.active was set both in JNDI and via the servlet
    context both profiles would end up being active, rather than the
    more intuitive behaviour of the profiles made active via the servlet
    context overriding those made active via JNDI.
    
    This commit updates SpringBootServletInitializer so that it explicitly
    creates the StandardServletEnvironment and initializes its property
    sources using the servlet context. This is done before the application
    is created and run, thereby ensuring that the servlet context
    property source is available throughout the application's startup.
    
    Closes gh-9972
    858b092a
Name
Last commit
Last update
.github Loading commit data...
.mvn Loading commit data...
eclipse Loading commit data...
spring-boot Loading commit data...
spring-boot-actuator Loading commit data...
spring-boot-actuator-docs Loading commit data...
spring-boot-autoconfigure Loading commit data...
spring-boot-cli Loading commit data...
spring-boot-dependencies Loading commit data...
spring-boot-deployment-tests Loading commit data...
spring-boot-devtools Loading commit data...
spring-boot-docs Loading commit data...
spring-boot-full-build Loading commit data...
spring-boot-integration-tests Loading commit data...
spring-boot-parent Loading commit data...
spring-boot-samples Loading commit data...
spring-boot-starters Loading commit data...
spring-boot-test Loading commit data...
spring-boot-test-autoconfigure Loading commit data...
spring-boot-tools Loading commit data...
.editorconfig Loading commit data...
.gitignore Loading commit data...
.settings-template.xml Loading commit data...
.travis.yml Loading commit data...
CODE_OF_CONDUCT.adoc Loading commit data...
CONTRIBUTING.adoc Loading commit data...
LICENSE.txt Loading commit data...
README.adoc Loading commit data...
mvnw Loading commit data...
mvnw.cmd Loading commit data...
pom.xml Loading commit data...