Is it possible to get variables from a properties file (ex: application.properties) in a tasklet ?
This is my example :
@Component
@PropertySource("classpath:application-${spring.profiles.active}.properties")
public class MyTasklet implements Tasklet {
private static final Logger log = LoggerFactory.getLogger(MyTasklet.class);
@Value("${spring.datasource.username}")
String db_username;
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
log.info("db_username : " + db_username);
…
}
My log return null for db_username.
Regards.
3