0
我正在編寫一個彈簧應用程序。我有這樣的預定工作。如何在Spring中使用計劃作業覆蓋* .jasper文件?
@Async
@Scheduled(cron = "0 0 16 * * ?")
public void createReport()
{
// argJasperPath = /WEB-INF/jasperFiles/myreport.jasper
JasperPrint jasperPrint = JasperFillManager.fillReport(argJasperPath, argReportParams, argDataSource);
JasperExportManager.exportReportToPdfFile(jasperPrint, argOutputPath);
}
這運行在每天16:00並創建一個報告。我正在使用JasperReports來生成報告。我有myreport.jasper文件在/WEB-INF/jasperFiles/myreport.jasper,當我運行我的工作,同時生成報告,我得到FileNotFound exception
。
如何在我的預定方法中使用我的jasper文件?
你可以閱讀[的FileInputStream和FileNotFound異常(http://stackoverflow.com/questions/9681582/fileinputstream-and-filenotfound-例外)post – 2012-08-16 07:52:14
如何在此方法中使用ServletContext,這意味着調度方法? – vtokmak 2012-08-16 08:04:48