框架采用的是 SpringBoot+MybatisPlus+Shiro
我利用org.springframework.scheduling 创建定时任务:
/**
* 定时扫描WMS回传的数据,整理成报关数据
*/
@Scheduled(fixedDelay = 1000*60*10)//每10分钟执行一次。
public void reductionClearance(){
DefaultSecurityManager manager = new DefaultSecurityManager();
ThreadContext.bind(manager);
log.info("整理报关数据:");
ladingClearanceService.reductionClearance();
}
ladingClearanceService.reductionClearance();方法是操作数据库的。
这个定时任务每次执行都报错: There is no session with id [de1c4c42-498e-4a10-900b-63f95421a4f3] ,哪位遇到过这个问题啊?求指教。