Hi there,
I wonder if anyone could clarify the way PropertyOverrideConfigurer works with the spring 3 @Configuration.
Here are is my @Configuration class:
When using this configuration in the new AnnotationConfigApplicationContext like this:Code:@Configuration(value = "defaultConfig") public class DefaultConfig { @Bean() @Lazy(false) public BeanFactoryPostProcessor override() { PropertyOverrideConfigurer configurer = new PropertyOverrideConfigurer(); configurer.setLocation(new ClassPathResource("asset.properties")); configurer.setIgnoreInvalidKeys(false); configurer.setIgnoreResourceNotFound(false); configurer.setOrder(0); return configurer; } @Bean(name = "assetRepository") @Lazy(false) public IAssetRepository assetRepository() { return new JpaAssetRepository(); } }
I was expecting the following:Code:AnnotationConfigApplicationContext appContext = new AnnotationConfigApplicationContext(DefaultConfig.class);
1. an exception to be thrown if there was no file called asset.properties on the classpath or the file exists but the properties incorrectly reference beans.
2. if the file does exist and has valid properties they would override the properties of other beans defined in this @Configuration class.
Currently none of the above is happening.
Please can somebody let me know what I am doing incorrectly?


Reply With Quote