Project

General

Profile

feature request #8187

Updated by Andreas Kohlbecker about 5 years ago

the method `AbstractWebApplicationConfigurer.findProperty(String property, boolean required)` implements a similar strategy as the Spring `AbstractEnvironment` which has a configurable strategy to resolve properties via the `PropertySourcesPropertyResolver` 

 See  


 1. `StandardServletEnvironment` searches for properties from the sources in the below order. Properties in any of the below will take precedence over system properties and environment variables contributed by the StandardEnvironment superclass. 
     1. "servletConfigInitParams" 
     2. **"servletContextInitParams"** 
     3. "jndiProperties" 
 2. `org.springframework.core.env.StandardEnvironment` searches for properties from the sources in the following order: 
     1. **system properties** 
     2. system environment variables 


 The `AbstractWebApplicationConfigurer` uses the following sources in the order as listed below:  

 1. attribute to the **ServletContext** 
 2. **system property** 
 3. ~/.cdmLibrary/**cdmlib-remote.properties** this is used by developers to define the datasource bean to use from the datasources.xml. It is not relevant for production systems. 


 Using the Şpring `Environment` would simplify setting up test an production environments a lot since we would be able to use application properties files and System properties to configure hibernate, spring profiles etc... and may also help solving the problem of the creation of datasources via Spring HTTP-Invoker (#5601) 

 When switching to the Şpring `Environment` we would need a replacement for the mechanism which loads `~/.cdmLibrary/cdmlib-remote.properties`. This can be easily replaced by  
 `@PropertySource("file:${user.home}/.cdmLibrary/cdmlib-remote.properties")` 
 

Back