でオーバーライドサービス、XPlugin.groovyで豆をオーバーライドだけ方法)(doWithSpringにサービスを再定義するために必要:既に、私はGrailsの3でプログラミングを開始Grailsの3:Grailsの2においてdoWithSpring
def doWithSpring = {
tokenStorageService(TokenStorageProxyService) { it.autowire = 'byName' }
}
私は私の既存のGrailsの一部2つのプラグインのGrailsの3バージョン作成していて、Grailsの2の経験を持って、新しいプラグインでオーバーライドの同じ種類を試してみました:
Closure doWithSpring() { {->
tokenStorageService(TokenStorageProxyService) {
it.autowire = 'byName'
}
} }
を私はいくつかの統合テストを行った。
テストを実行するとき@Integration
class SecurityServiceIntegrationSpec extends Specification {
SecurityService securityService
TokenStorageProxyService tokenStorageService
...
}
、私はエラーを取得する:
org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'grails.plugin.springsecurity.rest.token.storage.jwt.JwtTokenStorageService' to required type 'com.b2boost.grails3.auth.client.TokenStorageProxyService' for property 'tokenStorageService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'grails.plugin.springsecurity.rest.token.storage.jwt.JwtTokenStorageService' to required type 'com.b2boost.grails3.auth.client.TokenStorageProxyService' for property 'tokenStorageService': no matching editors or conversion strategy found at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:605) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:400) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:119) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) ... at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: Cannot convert value of type 'grails.plugin.springsecurity.rest.token.storage.jwt.JwtTokenStorageService' to required type 'com.b2boost.grails3.auth.client.TokenStorageProxyService' for property 'tokenStorageService': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:306) at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:590) ... 37 more
デフォルトJwtTokenStorageServiceはサービスが統合テストに配線されている場合ConversionNotSupportedExceptionで、その結果、私のTokenStorageProxyServiceによってオーバーライドされていないようです。プラグインでサービスを無効にするにはどうすればよいですか?