1,applicationContext.xml中追加定义
<bean id="testService" class="test.TestService" />
2,Java代码中取得
WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext(); TestService testBean = (TestService)wac.getBean("testService")
1,applicationContext.xml中追加定义
<bean id="testService" class="test.TestService" />
2,Java代码中取得
WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext(); TestService testBean = (TestService)wac.getBean("testService")