I was trying to externalise my configuration of a class level annotation using allication.yaml. But the spring is not loading it right. Any idea how to do this ?
Here is my Service classI am trying to set
@Service
@DefaultProperties(threadPoolProperties = {
@HystrixProperty(name = "coreSize", value =
"${cyclone.hystrix.lease.thread.coreSize}") })
public class LeaseService {
}
And application.yml
cyclone:
hystrix:
lease:
thread:
coreSize: 10
Getting an error --
java.lang.IllegalArgumentException: bad property value. property name 'coreSize'. Expected int value, actual = ${cyclone.hystrix.lease.thread.coreSize}
I can load the same property using @Value("${cyclone.hystrix.lease.thread.coreSize}"). But not working on the above mentioned case. Any help on how to properly configure this ?
In order to make spring evaluate placeholders you need to register a
PropertySourcesPlaceholderConfigurer
bean using a static@Bean
method when using@Configuration
classes as follows:According to the JavaDoc: