java - Spring @Value annotation returns null
Spring can not inject @Value
to a static field directly.
you can either add inject the value through an annotated setter like this:
private static String keystoreType;
@Value("${client.keystore.type}")
public void setKeystoreType(String keystoreType) {
SendMessageController.keystoreType = keystoreType;
}
Or Change :
@Value("${client.keystore.type}")
private static String keystoreType;
to :
@Value("${client.keystore.type}")
private String keystoreType;