Index: Work/brxm/community/crisp/core/src/main/java/org/onehippo/cms7/crisp/core/resource/RepositoryMapResourceResolverProvider.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/Work/brxm/community/crisp/core/src/main/java/org/onehippo/cms7/crisp/core/resource/RepositoryMapResourceResolverProvider.java b/Work/brxm/community/crisp/core/src/main/java/org/onehippo/cms7/crisp/core/resource/RepositoryMapResourceResolverProvider.java --- a/Work/brxm/community/crisp/core/src/main/java/org/onehippo/cms7/crisp/core/resource/RepositoryMapResourceResolverProvider.java (revision f4561be70307adef9178cec10840ac00cfdd43bb) +++ b/Work/brxm/community/crisp/core/src/main/java/org/onehippo/cms7/crisp/core/resource/RepositoryMapResourceResolverProvider.java (date 1646647667000) @@ -43,12 +43,15 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.GenericApplicationContext; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.MutablePropertySources; +import org.springframework.core.env.PropertiesPropertySource; import org.springframework.core.io.ClassPathResource; import org.springframework.security.util.InMemoryResource; @@ -349,12 +352,15 @@ private AbstractApplicationContext createChildApplicationContext(final String beanDefs, String[] propNames, String[] propValues) { GenericApplicationContext childContext = new GenericApplicationContext(applicationContext); + ConfigurableEnvironment env = childContext.getEnvironment(); + MutablePropertySources propertySources = env.getPropertySources(); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(childContext); xmlReader.loadBeanDefinitions(new InMemoryResource(beanDefs)); xmlReader.loadBeanDefinitions(new ClassPathResource(PROFILE_BEAN_DEFS_RESOURCE_PATH)); Properties props = new Properties(); - + // Add a new PropertiesPropertySource as the first priority + propertySources.addFirst(new PropertiesPropertySource("crisp property source", props)); if (propNames != null && propValues != null) { for (int i = 0; i < propNames.length; i++) { if (propValues.length > i) { @@ -368,9 +374,9 @@ } log.debug("Setting PropertyPlaceholderConfigurer for a CRISP ResourceResolver's appContext with properties: {}.", props); - PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); + PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer(); ppc.setIgnoreUnresolvablePlaceholders(true); - ppc.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_FALLBACK); + ppc.setEnvironment(env); ppc.setProperties(props); childContext.addBeanFactoryPostProcessor(ppc);