我已經看到了幾篇關於這方面的文章,但是並沒有在Quartz中使用新的JobBuilder方法。石英2.1.5:嘗試使用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();