I have a Java Project with Spring MVC
.
I need to start TimerTasks already after my application is initialized, so I implemented the WebApplicationInitializer
Interface and I call it SystemInitializer
. Inside that class I have a @Autowired
property, that @Autowired
property is a DAO
class.
I need it cause I want to execute some tasks based in recordings from my data base. But that Autowired property is ever null.
public class SystemInitializer implements WebApplicationInitializer {
@Autowired
private DomainResearchDao domainResearchDao;
@Override
public void run() {
if (this.domainResearchDao != null) {
System.out.println("OK");
}
// always here
else{
System.out.println("NO OK");
}
}