我已经看过几篇关于这个的帖子,但是不要使用 Quartz 中新的 JobBuilder 方法。
我正在尝试使用存储类名的字符串动态创建 JobDetail 。但是我收到以下编译器错误:
The method newJob(Class<? extends Job>) in the type JobBuilder is not applicable
for the arguments (Class<capture#6-of ?>)
这是代码:
String s = "ClassName";
Class<?> jobClass = null;
try {
jobClass = Class.forName (s);
} catch (ClassNotFoundException e) {
e.printStackTrace();
throw new MsgException ( "Requested Job Class not found" );
}
JobDetail jobDetail = newJob(jobClass).
withIdentity(jobKey).
withDescription(description).
storeDurably().
usingJobData(dataMap).
build();