问题如下:
今天配置Spring 环境,在引入完Spring的jar包并调试如下这段代码的时候public class Test {
public static void main(String[] args) throws Exception {
BeanFactory factory = new ClassPathXmlApplicationContext("applicationContext.xml");
Object o = factory.getBean("v");
Moveable m = (Moveable)o;
m.run();
}}抛出这段如下异常:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
看了马老师的视频,又上网查了一下说是引入commons-logging-1.1.1.jar
引入了该jar包,之后提示新异常,如下:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'v' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'accountDao' while setting bean property 'accountDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'accountDao' is defined现正在寻求方法中,希望懂得的朋友给个建议,不胜感激Spring异常Spring BeanFactoryJava