public void contextInitialized(ServletContextEvent event) {
System.out.println("初始化 application");
ServletContext application = event.getServletContext();
WebApplicationContext appctx = WebApplicationContextUtils.getWebApplicationContext(application);
RoomService roomService = appctx.getBean(RoomService.class);
//等等
}
————————————————
版权声明:本文为CSDN博主「明明如月学长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/w605283073/article/details/50719650