What is the equivalent of @EnableTransactionManagement XML in Spring 4?

What is the @EnableTransactionManagement XML equivalent in Spring 4?

By the way, as a newbie to Spring, I have no idea where to look for such XML equivalents for other annotations.

+6
source share
2 answers

This should complete the task:

 <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">   <property name="entityManagerFactory" ref="myEmf" /> </bean> <tx:annotation-driven transaction-manager="txManager" /> 

I don't know where to look for such XML equivalents for other annotations.

http://docs.spring.io/autorepo/docs/spring/4.2.x/spring-framework-reference/html/transaction.html#transaction-declarative-annotations

+8
source

In addition to the @LakatosGyula answer , if using Hibernate with Spring this configuration will do the job:

 <tx:annotation-driven transaction-manager="txManager"/> <bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> 
+2
source

All Articles