SpringN Demo的ClassNotFoundException问题

时间:2013-02-09 20:26:26

标签: spring

我无法运行程序。

线程“main”中的异常org.springframework.beans.factory.CannotLoadBeanClassException:找不到类路径资源[beans.xml]中定义的名为“hello”的bean的类[com.tutorialspoint.HelloWorld];嵌套异常是java.lang.ClassNotFoundException:

enter image description here

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:3)

您的bean定义必须指向类而不是包名称

<bean id="hello" class="com.tutorialspoint.HelloWorld.MainApp">
    <property name="message" value="Hello Man"></property>
</bean>

答案 1 :(得分:0)

您的Spring Beans配置是完美的,但您必须根据您的代码为MainApp类中的ApplicationContext提供正确的路径,您的路径应为“main / resource / beans.xml”。希望这会奏效......