springboot websocket service注入失败
作者:
织梦少年666 | 来源:发表于
2018-11-28 17:14 被阅读1次在websocket里面,注入service进行数据库操作时,service为空注入失败

image.png
ConfigurableApplicationContext run = SpringApplication.run(QuantradingCollectApplication.class, args);
WebSocketMarket.setAllpicationContext(run);

image.png
private HistoryDataMinService historyDataMinService;
private static ApplicationContext allpicationContext;
public static void setAllpicationContext(ApplicationContext context){
allpicationContext = context;
}

image.png
historyDataMinService = (HistoryDataMinService) allpicationContext.getBean(HistoryDataMinService.class);

image.png

image.png
本文标题:springboot websocket service注入失败
本文链接:https://www.haomeiwen.com/subject/xsjzqqtx.html
网友评论