I'm using a properties file with the value:
com.abc.cpuUtilization.okThreshold = 0.5
I want to use the following configuration class:
@Component
@ConfigurationProperties(prefix="com.abc")
public class SystemConfiguration{
@Value("${cpuUtilization.okThreshold}")
private Double cpuUtilizationOkThreshold;
// getters and setters of cpuUtilizationOkThreshold
}
}
But I get an exception of Could not resolve placeholder 'cpuUtilization.okThreshold'
When setting @Value to be: "${com.abc.cpuUtilization.okThreshold}" it works, but it makes the code look ugly and cumbersome.
Is there a way to configure this class, so I will not have to write the whole prefix for the @Value annotation?