NetBeans配置Spring-Cannot find class [M:\workspace\MySpring\src\com\jin\Chinese.java] for bean with name 'chineseId' defined in class path resource [bean.xml];

 <bean id="obstacle1" class="C:\launchCodeFiles\src\main\java\RunMario.java">

改为

<bean id="obstacle1" class="RunMario">

class路径为(包名+类名)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
       
    <bean id="chineseId" class="com.jin.Chinese">
        <property name ="axe" ref="stoneAxeId"></property>
    </bean>
    <bean id="stoneAxeId" class="com.jin.StoneAxe">
    </bean>
</beans>

 

点赞