1

I have Grails test:

class GormTests extends GroovyTestCase {
   static transactional = false
   ...
}

I'm trying to mark method as transactional by org.springframework.transaction.annotation.Transactional annotation but following exception arises:

org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class GormTests]: Common causes of this problem include using a final class or a non-visible class; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null

How can I fix it?

4

1 回答 1

2

@Transactional仅适用于 Spring bean - 测试类不是 bean。最好的办法是将测试类分成两部分,一类带有非事务性测试,另一类带有。

于 2012-09-17T16:42:28.333 回答