I\'ve been thinking around the Java feature that evaluates annotation values in compile-time and it seems to really make difficult externalizing annotation values.
H
If you want to make this work with annotation rather than bean configuration xml, you can use the following annotations: @Component, @PropertySource with PropertySourcesPlaceholderConfigurer Bean itself, like this:
@Component
@PropertySource({ "classpath:scheduling.properties" })
public class SomeClass {
@Scheduled(fixedDelay = "${delay}")
public void someMethod(){
// perform something
}
@Bean
public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}