Announcement Announcement Module
Collapse
No announcement yet.
Unsatisfied dependency problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      thanks a lot for the solve.

      Comment

      Working...
      X