狼王_ 2021-07-29 18:49 采纳率: 0%
浏览 522
已结题

SpringBoot + Shiro 定时任务报错 SessionContext must be an HTTP compatible implementation

我的项目是用了 SpringBoot + shiro,然后在系统中创建定时任务时报错

定时任务:
@Slf4j
@Component
@EnableScheduling // 1.开启定时任务
@EnableAsync // 2.开启多线程
public class ScheduleTask {

@Scheduled(fixedDelay = 1000*10)
//@Scheduled(fixedDelay = 1000*60)
public void reductionClearance(){
    DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
    ThreadContext.bind(manager);
    log.info("整理报关数据:");
        //调用Service层方法操作数据库
    ladingClearanceService.reductionClearance();
}

报错信息:
SessionContext must be an HTTP compatible implementation.

  • 写回答

1条回答 默认 最新

  • 狼王_ 2021-07-30 13:07
    关注

    DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
    改成
    DefaultSecurityManager manager = new DefaultSecurityManager();
    就可以了

    评论

报告相同问题?

问题事件

  • 系统已结题 8月6日
  • 创建了问题 7月29日

悬赏问题

  • ¥15 jetson nano
  • ¥15 :app:debugCompileClasspath'.
  • ¥15 windows c++内嵌qt出现数据转换问题。
  • ¥20 公众号如何实现点击超链接后自动发送文字
  • ¥15 用php隐藏类名和增加类名
  • ¥15 算法设计与分析课程的提问
  • ¥15 用MATLAB汇总拟合图
  • ¥15 智能除草机器人方案设计
  • ¥15 对接wps协作接口实现消息发送
  • ¥15 SQLite 出现“Database is locked” 如何解决?