今天在websocket 中 进行创建定时任务,使用@Autowired报错,一直null ,解决办法如下:
//@Autowired
private static ThreadPoolTaskScheduler threadPoolTaskScheduler;
@Autowired
public void setChatService(ThreadPoolTaskScheduler threadPoolTaskScheduler) {
WebSocket.threadPoolTaskScheduler = threadPoolTaskScheduler;
}
具体详情:
https://blog.csdn.net/m0_37202351/article/details/86255132