As in the question stated, what is the best way to use a grails service in the groovy sources? I'm working currently with this code:
private RoleService roleService;
public RoleCommand() {
this.roleService = (RoleService) Holders.getGrailsApplication().getMainContext().getBean("roleService");
}
Is there a better way to do this?
Edit / Solution: I solved it using Spring Dependency Injection (annotating the Class with @Component and register the package using the @ComponentScan Annotation in the Application.groovy file)