How do I unit test a Grails service that uses a converter?
Even though you are testing a service, you can apply the @TestMixin(ControllerUnitTestMixin) annotation to your test class to get Grails to set up the JSON converter.
Even though you are testing a service, you can apply the @TestMixin(ControllerUnitTestMixin) annotation to your test class to get Grails to set up the JSON converter.
If you need it in an artifact that supports dependency injection, simply inject grailsApplication class MyController { def grailsApplication def myAction = { def bar = grailsApplication.config.my.property } } If you need it in a bean in, say, src/groovy or src/java, wire it up using conf/spring/resources.groovy // src/groovy/com/example/MyBean.groovy class MyBean { def grailsApplication def foo() … Read more