当我将Grails渲染插件(compile "org.grails.plugins:rendering:2.0.1"
)添加到我的依赖项中时,所有带控制器的SpockUnit测试都会被破坏。
我得到的错误是:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [grails.plugins.rendering.image.PngRenderingService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
... 38 more
此外,我的build.gradle文件依赖于Spring测试:runtime 'org.springframework:spring-test:4.1.7.RELEASE'
。据我所知,这是渲染插件所需要的
Grails版本: 3.0.9