I am using Spring Java config to create my bean. But this bean is common to 2 applications. Both have one property file abc.properties but with different classpath locations. When i put explicit classpath like
@PropertySource("classpath:/app1/abc.properties")
then it works but when i try to use wildcard like
@PropertySource("classpath:/**/abc.properties")
then it doesn't work.
I try many combinations of wildcard but it still not working.
Is wildcard works in @ProeprtySource
Is there any other way to read to property in classed marked with @Configurations
.
Addidtionally to dmay workaround:
Since Spring 3.1 PropertySourcesPlaceholderConfigurer should be used preferentially over PropertyPlaceholderConfigurer and the bean should be static.
@PropertySource API:
Resource location wildcards (e.g. **/*.properties) are not permitted; each location must evaluate to exactly one .properties resource.
workaround: try