spring4.0配置openSessionInViewInterceptor报错,求救~

yunyunyunyu 2014-06-30 05:23:51
为了处理hibernate延迟加载的问题,就在springMVC.xml中增加了如下代码,结果报错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in URL [file:/D:/apache-tomcat-6.0.37-windows-x86/apache-tomcat-6.0.37/webapps/ST/WEB-INF/classes/config/springMVC.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '' is defined。
<!-- 处理hibernate延迟加载 -->
<bean name ="openSessionInViewInterceptor" class="org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="openSessionInViewInterceptor" />
</list>
</property>
<property name="mappings">
<value>/*</value> <!-- 需要拦截的url -->
</property>
</bean>
...全文
338 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
SunnyWMG 2015-04-30
  • 打赏
  • 举报
回复
问题解决了吗?
Defonds 2014-07-01
  • 打赏
  • 举报
回复
1、确认web 中配置 spring 的配置文件没问题 2、确认action 中调用的 dao 接口已经注入 3、name ="openSessionInViewInterceptor" 换成 id="openSessionInViewInterceptor" 试试

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧