Springboot使用WebSocket是无法通过@Autowired注入bean问题解决
一次开发WebSocket时发现无法通过@Autowired注入bean,一直为空。
解决办法:在
@ServerEndpoin中在这里插入代码片加入以下代码:
//此处是解决无法注入的关键
private static ApplicationContext applicationContext;
//你要注入的service或者dao
private CDSocketMessageService...
转载
2019-02-27 17:37:53 ·
1491 阅读 ·
0 评论