Autowired issue
fsanna13 opened this issue · comments
fsanna13 commented
Using IntelliJ, the Autowired
annotation for the jdbcTemplate
variable is labeled as an issue.
...
public static void main(String[] args) {
SpringApplication.run(SpringjdbcApplication.class, args);
}
@Autowired //Field injection is not recommended
JdbcTemplate jdbcTemplate;
@Override
public void run(String... args) throws Exception {
log.info("Creating tables");
...
It says that "Field injection is not recommended". How to solve this?
Jay Bryant commented
I assigned Greg Turnquist to this one, as a way to get a good answer to your question. Once Greg does so, we can close it.