开发者

Applying additional aspectj around advice to a spring transactional method

开发者 https://www.devze.com 2022-12-16 05:45 出处:网络
I have a spring 2.5 + hibernate webapp with transaction annotations and everything works fine. I now want to add a fairly basic aspect with \'around\' advice and apply it to my service layer (which i

I have a spring 2.5 + hibernate webapp with transaction annotations and everything works fine.

I now want to add a fairly basic aspect with 'around' advice and apply it to my service layer (which is transactional). I am doing this using aspectj annotations and placed

<aop:aspectj-autoproxy/> 开发者_JS百科

in my spring xml.

Spring transactional unit tests show it working no problems, however once I run it in tomcat I get a:

"No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here."

It's as if the aspectj autoproxy is blowing away the previously declared transactional annotations.

Has anyone seen this before? I attempted to google the issue but most examples don't show adding around advice to a transactional annotated method.

Cheers!


Wow, I just wasted 2 hours on this problem until I realised I had deleted:

<tx:annotation-driven/>

I'm feeling pretty smart right now...

0

精彩评论

暂无评论...
验证码 换一张
取 消