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.
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.
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 :-)
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>