Spring cannot inject been in class that implements Quartz Job

I am trying to send an email from a class that implements Quartz Job, in order to do that I have to @Autowire the IEmailService inside the class.

Here is the method I use to create a Quartz Job:

@Override

public Boolean sendInfoEmail(ManifestationProp manifProp, ServletRequest request) throws SchedulerException {

HttpServletRequest httpRequest = (HttpServletRequest) request;

String token = httpRequest.getHeader("jwt_token");

if(token == null) {

System.out.println("(ManifestationPropDaoImp) - TOKEN NULL");

return false;

}

String email = tokenUtils.getUsernameFromToken(token);

User user = userDao.findUserByEmail(email);

if(update(manifProp) != null) {

Scheduler sc = StdSchedulerFactory.getDefaultScheduler();

sc.start();

JobKey jobKey = new JobKey("Job_"+manifProp.getId(),"group1");

if(!sc.checkExists(jobKey)) {

System.out.println("-----------------------------------------------");

System.out.println("Scheduling a Job for Manifestation Prop with ID - "+ manifProp.getId());

System.out.println("Current...

Read More »

By: StackOverFlow - Monday, 16 April

Related Posts