我想在事件(CrudRepository(IgniteRepository))存储库中做一些工作。但是当我有一个构造函数甚至是空的构造函数时,我都会遇到一个异常。
public class UpdateStatusJob implements Job {
private TaskRepository TaskRepo;
// UpdateStatusJob(){}
UpdateStatusJob(TaskRepository taskRepo) throws
JobExecutionException
{
this.taskRepo= taskRepo;
}
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
System.out.println("Events!!!!!");
}
}
例外:
org.quartz.SchedulerException:作业实例化失败 在org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:45) 在org.quartz.core.JobRunShell.initialize(JobRunShell.java:127) 在org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:392) 造成原因:java.lang.InstantiationException: com.mphasis.eventinsights.scheduler.UpdateStatusJob 在java.lang.Class.newInstance(Class.java:427) 在org.springframework.scheduling.quartz.AdaptableJobFactory.createJobInstance(AdaptableJobFactor y.java:58) org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:41)
由于:java.lang.NoSuchMethodException: com.jp.tande.scheduler.UpdateStatusJob。() 在java.lang.Class.getConstructor0(Class.java:3082) 在java.lang.Class.newInstance(Class.java:412)
我需要taskRepo进行一些操作,但是调用构造函数失败。