Results 1 to 3 of 3

Thread: AbstractTransactionalSpringContextTests and autowire by name

  1. #1

    Default AbstractTransactionalSpringContextTests and autowire by name

    AbstractTransactionalSpringContextTests is a great, great thing, but is it possible to have it autowire by name instead of type? Autowire by type fails when the configuration has a transaction proxy. Thanks.

  2. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    1. Use an inner bean in TransactionProxyFactoryBean config and you avoid ambiguity.

    2. Yes, you can use autowire by name, with protected fields. See the Javadoc.

    I'm happy you like the class...so do I :-)
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  3. #3

    Default

    Ah, inner bean is a very neat solution I wasn't aware of before. Thanks! For anyone else, here's an example:

    Code:
    <bean id="productManager" 
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager"/>
    		</property>
    		<property name="target">
    			<bean class="com.foo.FooManager"/>
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
    			</props>
    		</property>
    	</bean>

Similar Threads

  1. autowire for struts action
    By houyunf in forum Web
    Replies: 2
    Last Post: Sep 2nd, 2005, 12:33 PM
  2. Replies: 1
    Last Post: Aug 17th, 2005, 01:44 PM
  3. autowire and parent bean
    By huydo in forum Container
    Replies: 1
    Last Post: Mar 23rd, 2005, 12:19 AM
  4. Implementing AutoWire at request.
    By Lachezar in forum Container
    Replies: 4
    Last Post: Nov 22nd, 2004, 08:53 AM
  5. Replies: 2
    Last Post: Nov 2nd, 2004, 06:22 AM

Posting Permissions

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