你去看看你ApplicationContext.xml文件定义userlistService,初始错了。
把定义userlistService bean的配置贴出来看看。
你有没有在这个bean里面注入 sessionFactory 和 hibernateTemplate

解决方案 »

  1.   

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
       <property name="dataSource">
         <ref local ="dataSource"/>
         </property>
         <property name="mappingResources">
         <list>
         <value>com/oa/model/bean/Userlist.hbm.xml</value>
         </list>
         </property>
       <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    </props>
    </property>
    </bean>
      <!-- 创建事物管理-->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
           <ref local="sessionFactory"/>
         </property>
    </bean>
      <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
         <property name ="sessionFactory">
           <ref local="sessionFactory"/>
           </property>
      </bean><bean id="userlistDAO" class="com.oa.model.dao.impl.UserlistDAO">
         <property name ="sessionFactory">
           <ref local="sessionFactory"/>
           </property>
    </bean>
    <bean id="userlistDaoProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref bean="transactionManager" />
    </property>
    <property name="target">
    <ref local="userlistDAO" />
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="save*">PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException</prop>
    <prop key="find*">PROPAGATION_REQUIRED,readOnly,-OrderException</prop>
    <prop key="get*">PROPAGATION_REQUIRED,readOnly,-OrderException</prop>
    </props>
    </property>
    </bean>
    <bean id="userlistService" class="com.oa.model.service.impl.UserlistService">
         <property name="userlistDAO">
         <ref bean="userlistDaoProxy"/>
         </property>
    </bean>这个样子了,帮忙看看