如何解决websocket 打开连接就立刻关闭
之前写小程序时遇到了一个问题,websocket一旦使用立马关闭,也不报错,但是也不运行,查了很多博客也没查出原因,后来无意中发现,是websocket不可以使用ssm的注入方式。
ApplicationContext act = ApplicationContextRegister.getApplicationContext();
UserService userService = act.getBean(UserService.class);
HouseService houseService=act.getBean(HouseService.class);
改成这种注入方式之后,websocket就可以正常运行了!