<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/mldn"></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.MySQLDialect
</prop>
  <!-- 表示允许自动提交 -->
                <prop key="hibernate.connection.autocommit">true</prop>
                <!-- 显示sql语句 -->
                <prop key="hibernate.show_sql">true</prop>

</props>
</property>
<property name="mappingResources">
<list>
<value>com/mldn/vo/User.hbm.xml</value>
</list>
</property>
</bean>
  <bean id="hibernateTemplate" 
        class="org.springframework.orm.hibernate3.HibernateTemplate">
        <property name="sessionFactory">
            <ref bean="sessionFactory"/>
        </property>
    </bean>    
<bean id="iuserdao" class="com.mldn.dao.IUserDAO" 
        abstract="true">
    </bean>
    <bean id="iuserdaoimpl" class="com.mldn.dao.impl.IUserDAOImpl" 
        parent="iuserdao">
        <property name="hibernateTemplate">
            <ref bean="hibernateTemplate"/>
        </property>
    </bean> </beans>红色的那行为什么报这个错No setter found for property 'hibernateTemplate' in class 'com.mldn.dao.impl.IUserDAOImpl'

解决方案 »

  1.   

    应该读懂这个英文啊......
     检查下你的 com.mldn.dao.impl.IUserDAOImpl 类中是否存在 hibernateTemplate 属性的 setter 方法
      

  2.   

    hibernateTemplate在IUserDAOImpl里面生成get set方法了吗
      

  3.   

    No setter found for property 'hibernateTemplate' in class 'com.mldn.dao.impl.IUserDAOImpl'    
    说明没有找到关于属性 hibernateTemplate  的set方法  你检查检查
      

  4.   

    IUserDAOImpl中没有定义
    public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
    this.hibernateTemplate = hibernateTemplate;
    }
      

  5.   

    iuserdaoimpl 这个应该是你的dao实现类吧,这个问题不好说,要看你的dao层是如何设计的。联系我QQ309545051,我给你发个demo,我刚研究的一些东西,应该对你有帮助