Tuesday, March 4, 2014

Resolve org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined

Removed
When testing my application, an error appear :

 org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined

In fact, in the ApplicationContext, I am defining the transaction manager with another name:
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">

So, as Spring is checking for the default name, I just put it in my configuration.
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">

I have seen that it is possible to use another name, nut you should sepcify it in the @Transactional annotation:
@Transactional(value="myTxManager")

Now it is working ;)

1 comment :

Articles les plus consultés