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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The Spring
ApplicationContextis available as thectxvariable in the console, and you can use this to access Spring beans such as services. Typically that would bedef myService = ctx.getBean('myService')but Grails adds a metaclass helper so you can just dodef myService = ctx.myService