Very simple usage
An instance of
GroovyRestlet is the starting point of everything.
You can programmatically create an instance of
Constructor method of #2 indicates that this instance of
GroovyRestlet will consult Spring's ApplicationContext when constructing its component. So the Spring integration is done.
Alternatively, you can choose to declare
GroovyRestlet in Spring bean definition. By this way,
GroovyRestlet will automatically use its parent context when constructing its compoents.
When Spring's ApplicationContext is provided,
GroovyRestlet will try to consult Spring context for creating its components.
Two special attributes are provided for integrating
GroovyRestlet and Spring.
- ofBean: to tell
GroovyRestletthat to create a component from Spring context by a bean name;
- ofClass: to tell
GroovyRestletthat to create a component using Spring's AutowireCapableBeanFactory
RestletBuilder is a simple implementation of Groovy's FactoryBuilderSupport. By default, all constructor factories are registered. Users are able choose which constructors are to be used freely.
To do this programmatically, just set a list of constructor factories after a build instance is created.
Alternatively, you can do this in Spring bean definition