不能像controller一样直接引入
需要更改启动方式
参考博客
Spring Boot Service注入为null mapper注入为null @Component注解下@Value获取不到值 WebsocketServer类里无法注入service - 綦霖 - 博客园 (cnblogs.com)https://www.cnblogs.com/yangchengdebokeyuan/p/10621788.html

不能像controller一样直接引入
需要更改启动方式
参考博客
Spring Boot Service注入为null mapper注入为null @Component注解下@Value获取不到值 WebsocketServer类里无法注入service - 綦霖 - 博客园 (cnblogs.com)https://www.cnblogs.com/yangchengdebokeyuan/p/10621788.html