0

我无法运行该程序。

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

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

4

2 回答 2

3

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

<bean id="hello" class="com.tutorialspoint.HelloWorld.MainApp">
    <property name="message" value="Hello Man"></property>
</bean>
于 2013-02-09T21:51:58.150 回答
0

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

于 2013-02-10T13:24:45.357 回答