Transaction configuration for Spring Java configured context

Eugen picture Eugen · Nov 9, 2010 · Viewed 14.6k times · Source

I've been struggling with this for a few hours now.

I'm trying to migrate my Spring XML configuration to a full Java based configuration.

I'm using AnnotationConfigApplicationContext as a context implementation.

I'm having trouble finding an Java equivalent for this line, from my old XML configuration:

<tx:annotation-driven transaction-manager="transactionManager" />

As a result, Spring doesn't manage the transactions.

In my Java configuration I have initialized the relevant beans for transactions: the session factory, the transactional manager, etc, but without that line, no transaction proxy is used, so no transactions are actually in place.

So my question is how do I either translate that line to my Java context configuration or how to I go about solving the problem in another way.

Any help is appreciated. Thanks.

Answer

AHungerArtist picture AHungerArtist · May 10, 2012