I am aware of possibility to validate the external configuration of a Spring Boot configuration done by the help of configuration properties (@ConfigurationProperties
) and bean validation.
But how can I validate properties used in placeholders like in this code snippet:
@Component
public class Receiver {
@JmsListener(destination = "${jms.queuename}", containerFactory = "myFactory")
public void receiveMessage(Email email) {
System.out.println("Received <" + email + ">");
}
}
The only workaround I can imagine is to use the same property also in a configuration properties class like this.
@ConfigurationProperties(prefix = "jms")
@Validated
public class JMSProperties {
@NotNull
String queuename;
}
Any hint?