Results 1 to 2 of 2

Thread: How to inject service into another Service?

  1. #1

    Default How to inject service into another Service?

    Hi,
    I have few Services defined in the context file for example

    <bean id="RevenueOptimizationServiceTarget" class="com.uprr.app.itr.springs.services.revenueop timization.RevenueOptimizationServiceImpl">

    <bean id="revenueOptimizationService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager" ref="txManager"/>
    <property name="target" ref="RevenueOptimizationServiceTarget"/>
    <property name="transactionAttributeSource" ref="noTxAttributeSource" />
    </bean>


    If I want to inject another service into this.
    Is it a right way. if so how can i do this.

  2. #2
    Join Date
    Sep 2006
    Posts
    26

    Default

    Doesn't the RevenueOptimizationServiceImpl have fields you can use? Or am I missing something?

    Code:
    <bean id="RevenueOptimizationServiceTarget" class="com.uprr.app.itr.springs.services.revenueop timization.RevenueOptimizationServiceImpl">
    
    <bean id="revenueOptimizationService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager" ref="txManager"/>
    <property name="target" ref="RevenueOptimizationServiceTarget"/>
    <property name="transactionAttributeSource" ref="noTxAttributeSource" />
    </bean>
    
    <property name="theService" ref="theService" />
    </bean>

Posting Permissions

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