我有其被定义为这样的非服务类:将服务传递给grails中的非服务?
class A{
B b
A(B b){ this.b = b }
}
其中B是一个Grails服务。在我的单元测试,我尝试这样做:
A a = new A(new B());
出于某种原因,然而,b
永远不会被设置,以及可变b [local, the argument to the mehod]
运行测试时,甚至没有可见的Intelli-J的调试器。也就是说,我可以将参数重命名为service
,调试器将其显示为未定义。
当我尝试启动服务器时,得到Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
,所以我假设这是相关的。
这是怎么回事?
这有帮助吗? http://stackoverflow.com/questions/1703952/grails-how-do-you-unit-test-a-command-object-with-a-service-injected-into-it/ – 2011-01-31 09:00:27