[jboss-dev-forums] [Design of POJO Server] - Re: TransactionManagerLocator has instance before TM is read

adrian@jboss.org do-not-reply at jboss.com
Tue Nov 4 09:58:06 EST 2008


No. If you want to do that, i.e. a real dependency, don't use the TransactionManagerLocator.

You should inject it directly, see jca-beans.xml:

  |          <!-- The transaction manager -->
  |      <property name="transactionManager"><inject bean="TransactionManager" property="transactionManager"/></property>
  | 

If you wanted to further an just use the anonymous inject, i.e.


  | @Inject // No name implies match the interface to the only implementation
  | public void setTransactionManager(TransactionManager tm);
  | 
  | or xml equivalent
  | 
  |      <property name="transactionManager"><inject/></property>
  | 
  | 

Then we'd need to make MC aware of the instance in transaction-jboss-beans.xml


  | <bean name="RealTransactionManager">
  |    <constructor factoryMethod="getTransactionManager">
  |       <factory bean="TransactionManager"/>
  |    </constructor>
  | </bean>
  | 

Since the thing called TransactionManager is not really a TM, its a factory for it. :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186729#4186729

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186729



More information about the jboss-dev-forums mailing list