服务器启动时 No bean named 'sessionFactory' is defined
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了服务器启动时 No bean named 'sessionFactory' is defined相关的知识,希望对你有一定的参考价值。
ApplicationContext ac = WebApplicationContextUtils
.getWebApplicationContext(event.getServletContext());
每一次调用这个就会使hibernate建立一个连接池,
applicationContext-hibernate.xml中有数据库连接信息,数据库表映射信息(sessionfactory),hibernateProperties
但是如果写成单独的
ApplicationContext ac = new FileSystemXmlApplicationContext(path);
path是applicationContext-xxx.xml 不包括applicationContext-hibernate.xml的内容就会报出
No bean named 'sessionFactory' is defined错误
如何解决啊。。。。。
关于启动tomcat 找不到 No bean named '*****' is defined
<!-- 扫描com包下的所有子类 不包含@controller -->
<context:component-scan base-package="com">
<!-- exclude排除 -->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
以上是关于服务器启动时 No bean named 'sessionFactory' is defined的主要内容,如果未能解决你的问题,请参考以下文章
spring jpa使用@service注解时失效提示No bean named 'countryService' is defined
No bean named 'cxf' is defined
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘cacheMana
No bean named 'sqlSessionFactory' is defined