I'm going to set fixedRate
-value in @Scheduled
dynamically.
For this aims I'm trying to use SpEL-abilities as following:
@AllArgsConstructor
public class ContentSender {
@Scheduled(fixedRateString = "#{OuterProperties.rateForMessageReading}")
public void contentModelMessageSource() throws IOException {
}
}
Class with target-property:
@Getter
@Setter
@ConfigurationProperties("app")
public class OuterProperties {
private static final long WAITING_INTERVAL = 100;
private long rateForMessageReading;
}
By as a result on the deploy-stage I receive:
SpelEvaluationException: EL1008E: Property or field 'outerProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public or not valid?
What am I doing wrong?
Problem is that I use only
@ConfigurationProperties
. When I add@Configuration
problem is gone.