Results 1 to 3 of 3

Thread: Unsatisfied dependency problem

  1. #1
    Join Date
    Jun 2007
    Posts
    18

    Default Unsatisfied dependency problem

    hello, i've encountered this peculiar problem, plz help me. this code below generates exception :
    Error creating bean with name 'userAction' defined in ServletContext resource

    Could not convert constructor argument value of type [$Proxy6] to required type [org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean]:


    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
    <property name="sessionFactory">
    <ref local="sessionFactory"/>
    </property>
    </bean>
    <bean id="UserDaoImpl" class="com.vonair.nexus.user.UserHibernateDaoImpl" >
    <property name="hibernateTemplate">
    <ref local="hibernateTemplate"/>
    </property>

    </bean>
    <bean id="UserDaoTarget" class="com.vonair.nexus.user.UserServiceImpl">
    <property name="userDao">
    <ref local="UserDaoImpl"/>
    </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory">
    <ref loca
    l="sessionFactory"/>
    </property>
    </bean>

    <bean id="UserDao" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="proxyInterfaces" value="com.vonair.nexus.user.IUserService"/>
    <property name="transactionManager">
    <ref bean="transactionManager"/>
    </property>
    <property name="target">
    <ref bean="UserDaoTarget"/>
    </property>

    <property name="transactionAttributes">
    <props>

    <prop key="add">PROPAGATION_REQUIRED</prop>
    <prop key="modify">PROPAGATION_REQUIRED</prop>
    <prop key="delete">PROPAGATION_REQUIRED</prop>
    <prop key="findByUniqueCode">PROPAGATION_REQUIRED,readOn ly</prop>
    </props>
    </property>
    </bean>

    <bean id="userAction"
    class="com.vonair.nexus.user.UserAction" >
    <constructor-arg> <ref bean="UserDao"/></constructor-arg>
    </bean>
    but i've used "UserDao" as userAction's construction argument which is of type org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean then whats the prb?

  2. #2
    Join Date
    Sep 2004
    Location
    London, UK
    Posts
    64

    Default

    For what you have introduced constructor with TransationProxyFactoryBean type, not IUserService?
    Code:
    <ref bean="UserDao"/>
    will be resolved into instance that TransationProxyFactoryBean provides, not in TransationProxyFactoryBean itself

  3. #3
    Join Date
    Jun 2007
    Posts
    18

    Default

    thanks a lot for the solve.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •