【Spring】Instantiation of bean failed; No bean class specified on bean definition

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cat' defined in class path resource [beans.xml]: Instantiation of bean failed; nested exception is java.lang.IllegalStateException: No bean class specified on bean definition

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cat' defined in class path resource [beans.xml]: Instantiation of bean failed; nested exception is java.lang.IllegalStateException: No bean class specified on bean definition

 

 

 

 

xml配置文件中,加一个属性class,如下:

<bean id="cat" name="org.example.pojo.cat" class="org.example.pojo.cat">
    <property name="id" value="1351231"/>
    <property name="name" value="Ninam"/>
</bean>