springboot项目中同时使用websocket,自带定时任务@Scheduled启动项目时报错
解决办法:增加配置文件。
·
springboot项目中同时使用websocket,自带定时任务@Scheduled启动项目时报错
Application run failed
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ‘defaultSockJsTaskScheduler’ is expected to be of type ‘org.springframework.scheduling.TaskScheduler’ but was actually of type ‘org.springframework.beans.factory.support.NullBean’
产生原有:两者冲突
解决办法:增加配置文件
@Configuration
public class ScheduledConf {
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduling = new ThreadPoolTaskScheduler();
scheduling.setPoolSize(10);
scheduling.initialize();
return scheduling;
}
}

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)