In a spring batch, I'm trying to access a property from application.properties
file in my StepExecutionListener
using spring's @value
annotation, but it turns out to be null
.
@Component
public class SomeListener implements StepExecutionListener {
@Value("${some.property}")
private String foo;
@Override
public void beforeStep(StepExecution stepExecution) {
System.out.println(foo);
}
}
This piece of code print null
.