puzuipin0606 2017-03-23 10:04 采纳率: 0%
浏览 1237

初学springMvc 与Hibernate的整合,求指点

贴上异常:

 严重: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionDecorator for element [annotation-driven]
Offending resource: ServletContext resource [/WEB-INF/spring-servlet.xml]
还有:
三月 23, 2017 5:27:45 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionDecorator for element [annotation-driven]
Offending resource: ServletContext resource [/WEB-INF/spring-servlet.xml]

还有spring-servlet.xml文件:

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"   
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
    xmlns:tx="http://www.springframework.org/schema/tx"   
    xmlns:mvc="http://www.springframework.org/schema/mvc"   
    xmlns:context="http://www.springframework.org/schema/context"   
    xsi:schemaLocation="http://www.springframework.org/schema/beans   
    http://www.springframework.org/schema/beans/spring-beans.xsd   
    http://www.springframework.org/schema/tx   
    http://www.springframework.org/schema/tx/spring-tx.xsd   
    http://www.springframework.org/schema/mvc   
    http://www.springframework.org/schema/mvc/spring-mvc.xsd   
    http://www.springframework.org/schema/context   
    http://www.springframework.org/schema/context/spring-context.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">
     <context:component-scan base-package="com.jwt"/>
    <context:property-placeholder location="classpath:application.properties"/>
    <mvc:annotation-driven/>
     <!-- Specifying the Resource location to load JS, CSS, Images etc --> 
     <mvc:resources location="/resources/**" mapping="/resources/"/>
     <!-- View Resolver -->
     <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
         <property name="prefix" value="/WEB-INF/pages/"/>
         <property name="suffix" value=".jsp"/>
     </bean>
     <!-- DataSource -->
     <bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="dataSource">
         <property name="dirverClassName" value="${database.driver}"></property>
         <property name="url" value="${database.url}"></property> 
         <property name="username" value="${database.user}"></property> 
         <property name="password" value="${database.password}"></property>
     </bean>

     <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
          <property name="dataSource" ref="dataSource"></property> 
          <property name="hibernateProperties">
              <props>
                  <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                  <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
                  <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> 
                  <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> 
              </props>
              </property>
              <property name="packagesToScan" value="com.jwt.model"></property>
     </bean>
     <!-- Transaction -->
     <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
         <property name="sessionFactory" ref="sessionFactory" />
          <tx:annotation-driven transaction-manager="transactionManager" />

     </bean>
    </beans>
  • 写回答

2条回答 默认 最新

  • Jun6620 2017-03-23 10:14
    关注

    没有时间,有时间给你看

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题