在Servlet获取spring管理的java对象

在Servlet获取spring管理的java对象:

private ConfigService getService() {
		if (cfgService == null) {
			WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
			cfgService = (ConfigService) context.getBean("configService");
		}
		return cfgService;
	}

相关推荐