java.lang.NoClassDefFoundError:org / springframework / expression / PropertyAccessor

时间:2016-08-01 08:19:27

标签: java spring noclassdeffounderror

//主要类

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
    public class MainClass {

public static void main(String[] args) {


    //BeanFactory _factory = new XmlBeanFactory(new ClassPathResource("check.xml"));        

    ApplicationContext _app = new FileSystemXmlApplicationContext("C:\\Users\\jpushpan\\Desktop\\JeffWorkSpace\\WorkSpace\\Test\\jeffSpring\\src\\check.xml");

    //TestClass _testi = (TestClass) _factory.getBean("test");
    TestClass _testi = (TestClass) _app.getBean("test");

    _testi.display();
}

}

//测试类

 public class TestClass {

String _msg;

public String getName() {  
    return _msg;  
}

public void setMsg (String msg)
{
    this._msg= msg;
}
void display()
{
    System.out.println("Message : "+_msg);
}

}

// xml文件

  <?xml version="1.0" encoding="UTF-8"?>
  <beans  
xmlns="http://www.springframework.org/schema/beans"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
xmlns:p="http://www.springframework.org/schema/p"  
xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-.0.xsd">    

<bean id="test" class="jeffSpring.TestClass">  
<property name="msg" value="jeffAyan"></property>  
</bean>  

</beans>  
  

我的代码完全适用于Bean工厂   Buts在应用程序上下文类中显示“java.lang.NoClassDefFoundError:org / springframework / expression / PropertyAccessor”错误

0 个答案:

没有答案