How do I get the services in the grails console? My business rules are implemented in services but I don't have access to them in the grails console. Does anyone know how to help me?
The Spring ApplicationContext
is available as the ctx
variable in the console, and you can use this to access Spring beans such as services. Typically that would be def myService = ctx.getBean('myService')
but Grails adds a metaclass helper so you can just do def myService = ctx.myService
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With