I have several different modules packaged in jars, where each has its own Spring config and its own PropertyPlaceholderConfigurer, declared via the context namespace. I then have an integration test that is loading all the application contexts via the classpath. It appears that only one (the last? the first?) PropertyPlaceholderConfigurer is found.
Specifically:
module1-context.xml
module2-context.xmlCode:<context:property-placeholder system-properties-mode = "OVERRIDE" location = "classpath:module1.properties"/>
module3-context.xmlCode:<context:property-placeholder system-properties-mode = "OVERRIDE" location = "classpath:module2.properties"/>
integration test:Code:<context:property-placeholder system-properties-mode = "OVERRIDE" location = "classpath:module3.properties"/>
when I run the test, it loads properties from one of the modules, but fails to load the others.Code:@ContextConfiguration({"classpath:main.xml", "classpath*:*-context.xml"}) public class MyTest extends AbstractJUnit4SpringContextTests {
I see debug log messages that the beans were found, but only one log message from PropertyPlaceholderConfigurer itself that it's loaded the properties file.
any thoughts? this is Spring 3.0.5.Code:15:13:04,176 [main] DEBUG o.s.c.s.GenericApplicationContext - Bean factory for org.springframework.context.support.GenericApplicationContext@148238f4: org.springframework.beans.factory.support.DefaultListableBeanFactory@1c23f1bb: defining beans [...,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,...] <snip> 15:13:04,556 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' 15:13:04,557 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' 15:13:04,559 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' to allow for resolving potential circular references 15:13:04,599 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' 15:13:04,600 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1' 15:13:04,601 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1' 15:13:04,601 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1' to allow for resolving potential circular references 15:13:04,602 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1' 15:13:04,603 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#2' 15:13:04,603 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#2' 15:13:04,603 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#2' to allow for resolving potential circular references 15:13:04,604 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#2' 15:13:04,605 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#3' 15:13:04,605 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#3' 15:13:04,605 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#3' to allow for resolving potential circular references 15:13:04,607 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#3' 15:13:04,607 [main] INFO o.s.b.f.c.PropertyPlaceholderConfigurer - Loading properties file from class path resource [module1.properties]


Reply With Quote