我尝试使用ClassPathXmlApplicationContext
获取bean。但我收到:NoSuchBeanDefitionException:没有定义名为“newController”的bean
ApplicationContext applicationContext = new
ClassPathXmlApplicationContext("classpath*:conf/Spring_Config.xml");
NewsController newsController = (NewsController)
applicationContext.getBean("newsController");
在xml中:
<bean id="newsController" class="NewsController"/>
为bean类标签添加完整路径
类=com.foo. NewsController