I know that you can simply inject a service in unit test method using:
defineBeans {
someService(SomeService)
}
But when I need to inject se
you can set your member variable which is service by using ref
MyService(MyProvider) {
userDetailsService = ref("userDetailsService")
springSecurityService = ref("springSecurityService")
userService = ref("userService")
}
Hope that helps
To use spring beans in a unit test you need to do the following:
defineBeans
closure.autowire
property to true
for beans that need to have other beans injected.For example:
defineBeans {
someService(SomeService) { bean ->
bean.autowire = true
}
some2Service(Some2Service)
}