Failed to convert property value of type [java.util.Properties] to required type [org.springframework.core.io.Resource] for property 'configLocation'<property name="configLocation">
  <value>classpath:hibernate.cfg.xml</value>
</property>
只用过这种配置的^_^

解决方案 »

  1.   

    这是我的你看看有没有帮助
    <?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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <bean id="DataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName"
    value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
    </property>
    <property name="url"
    value="jdbc:sqlserver://localhost:1433;databaseName=daquan">
    </property>
    <property name="username" value="sa"></property>
    <property name="password" value="110112"></property>
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="DataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>domain/Denglu.hbm.xml</value></list>
    </property>
        </bean>
        
       <!-- 事物管理 -->
    <bean id="tr"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <!-- 事务传播媒质及事务隔离级别 -->
    <tx:advice id="tx" transaction-manager="tr">
    <tx:attributes>
    <tx:method name="add*" propagation="REQUIRED" />
    <tx:method name="upd*" propagation="REQUIRED" />
    <tx:method name="del*" propagation="REQUIRED" />
    <tx:method name="*" read-only="true" />
    </tx:attributes>
    </tx:advice>
    <!-- 使用AOP将事务添加到业务方法上 -->
    <aop:config>
    <aop:pointcut id="allMothed"
    expression="execution(* mm.*.*(..))" />
    <aop:advisor advice-ref="tx" pointcut-ref="allMothed" />
    </aop:config>

    <bean name="/du" class="action.DuAction">
        <property name="du" ref="Dummsx"/>
    </bean>
    <bean id="Dummsx" class="mmsx.Dummsx">
       <property name="du" ref="Dujksx"></property>
    </bean>
    <bean id="Dujksx" class="daosx.Dujksx">
       <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
        
    </beans>