当前位置: 代码迷 >> Java Web开发 >> 【spring】注入成功,但是spring没有初始化bean,该如何解决
  详细解决方案

【spring】注入成功,但是spring没有初始化bean,该如何解决

热度:6593   发布时间:2013-02-25 21:20:46.0
【spring】注入成功,但是spring没有初始化bean
XML code
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans>    <bean id="baseTransactionProxy" abstract="true"        class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">        <property name="transactionManager">            <ref bean="transactionManager" />        </property>        <property name="transactionAttributes">            <props>                <prop key="delete*">PROPAGATION_REQUIRED</prop>                <prop key="saveOrUpdate*">PROPAGATION_REQUIRED</prop>                <prop key="save*">PROPAGATION_REQUIRED</prop>                <prop key="insert*">PROPAGATION_REQUIRED</prop>                <prop key="add*">PROPAGATION_REQUIRED</prop>                <prop key="create*">PROPAGATION_REQUIRED</prop>                <prop key="update*">PROPAGATION_REQUIRED</prop>                <prop key="modify*">PROPAGATION_REQUIRED</prop>                <prop key="remove*">PROPAGATION_REQUIRED</prop>                <prop key="manual*">PROPAGATION_REQUIRED</prop>                <prop key="pub*">PROPAGATION_REQUIRED</prop>                <prop key="sub*">PROPAGATION_REQUIRED</prop>                <prop key="stop*">PROPAGATION_REQUIRED</prop>                <prop key="store*">PROPAGATION_REQUIRED</prop>                <prop key="init*">PROPAGATION_REQUIRED</prop>            </props>        </property>    </bean>    <bean id="testSvc" parent="baseTransactionProxy" singleton="true">        <property name="target">            <bean class="svc.TestSvc" singleton="true">                <property name="testDao">                    <ref bean="testDao" />                </property>            </bean>        </property>    </bean></beans>

web.xml也配置好了
testSvc没有被初始化,我在注入的bean里面,打印testSvc == null,结果为true。哪里配置错了?
控制台没有错误信息。

------解决方案--------------------------------------------------------
你在什么地方打印这个信息呢?得详细描述下,呵呵呵。
------解决方案--------------------------------------------------------
set方法写了没?写正确没有?
  相关解决方案