spring 创建对象的异常

---恢复内容开始---

今天使用Spring框架创建对象,遇到如下异常:

 org.apache.catalina.core.StandardWrapperValve invoke SEVERE:

Servlet.service() for servlet [jsp] in context with path [] threw exception

[org.springframework.beans.factory.NoSuchBeanDefinitionException:

No unique bean of type [com.gede.dao.unit.SchoolTypeRltnDao] is defined:

expected single bean but found 0: ] with root cause

org.springframework.beans.factory.NoSuchBeanDefinitionException:

No unique bean of type [com.gede.dao.unit.SchoolTypeRltnDao] is defined:

expected single bean but found 0:   

总结来说,就是没有这个实体类 的对象,即创建失败

解决办法:

(1)注意  注意  注意

  要 明白 创建对象的方式:

Spring 两种创建对象的方式:

  a、用注解的方式

  b、用 配置文件xml 文件 写 bean 的 方式

 

posted @ 2018-02-01 18:50  stujike123456  阅读(269)  评论(0)    收藏  举报