解决方案 »

  1.   

    private DataBaseOper dataBaseOper;    get ()  set()方法
      

  2.   

    被注入的类中,  有set()方法
      

  3.   

    <bean id="dataSource"
    class="com.tydic.springframework.datasource.DriverManagerDataSource"
    init-method="init" /><bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation">
    <value>classpath:/config/sql-map-config.xml</value>
    </property>
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    </bean>
    <bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
    <property name="sqlMapClient">
    <ref bean="sqlMapClient" />
    </property>
    </bean><bean id="dataBaseOper" class="com.tydic.db.DataBaseOper">
    <property name="sqlMapClientTemplate">
    <ref bean="sqlMapClientTemplate" />
    </property>
    </bean>
      

  4.   

    xml是否被加载,类中是否存在get、set方法
      

  5.   


    </bean><bean id="StkInfoInsert" class="com.tydic.business.StkInfoInsert">
    <property name="dataBaseOper">
    <ref bean="dataBaseOper" />
    </property>
      

  6.   

    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!--
    contextConfigLocation在 ContextLoaderListener类中的默认值是
    /WEB-INF/applicationContext.xml
    -->
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
    <!-- <param-value>classpath:applicationContext*.xml</param-value> -->
    </context-param>
      

  7.   

    不能用main方法调用这个函数,main方法不需要启动服务的,因为你这个类是用注入的方法实现的,而注入是需要启动服务的,