I am currently trying to use the @Transactional annotation within my application and I seem to have some problems.
I have a perfectly running application where the advices and pointcuts are defined in the xml files.
To switch to use the @Transactional annotation and remove the xml files.
I started with a single interface and its implementation class
Within my applicationContext.xml I have used
When @Transactional is used on concrete class the code works fine
but when the same is used on an interface or methods of an iterface it does not seem to work as it should or so it seems.
On further reading the spring source reference I came to know that
Extract from the spring source ::
To be clear: using 'proxy-target-class="true"' on <tx:annotation-driven/>, <aop:aspectj-autoproxy/> or <aop:config/> elements will
force the use of CGLIB proxies for all three of them.
The CGLIB proxies are class based proxies
and though I was using
proxy-target-class="false" with the
<tx:annotation-driven/>
my applicationContext-aop had
proxy-target-class="true"
and hence class based proxies was being used and so it could not detect the @Transactional settings of the interface
So I commented all the advices and pointcuts within my xml files and changed the proxy-target-class setting to false within my applicationContext-aop.xml
and I have placed the
@Transactional annotation before my interface definitions as follows (shown here for only one interface)
and I have also place it on the Service interface also.
Now when I start my application I am getting the following exception (Fragments of my exception) :
There is a bean SampleValidator which takes as a constructor argument the SampleServiceImpl.
This is having some problem
Any help would be appreciated.
Thanks in advance