This page last changed on Feb 28, 2006 by glaforge.

Spring Integration

Beans can be configured to auto-wiring into Grails components by adding entries into the "%PROJECT_HOME%\spring\resources.xml" file of your Grails application. Controllers by default using auto-wiring by name so a bean defined as follows:

<bean id="myBean" class="MyBeanImpl"></bean>

Can be injected into a Grails controller by specifing a corresponding property name:

class SomeController {

     @Property myBean
     //.....
}

Grails service classes support injection by type or name, defaulting to type:

class SomeService {
     @Property MyBean myBean

     def serviceMethod() {
        myBean.invoke()
     }
}
Document generated by Confluence on Mar 29, 2006 08:46