How to handle new implementation when using AutoWire in spring?
In the grails doc, I read (something along the lines) that the implementation of a server class will bu automatically wired based on the naming convention.
If this is true, then how would one go about overriding this behavior down the road say if you have a new implementation?
do we have options? like:
- use @annotations
- if you don't want to开发者_JAVA百科 re-compile, add the entry to the xml
I am assuming "server class" was meant to be typed as "service class" and "bu"->"be"?
If those assumptions are correct: yes, they are autowired.
You create a grails service called UserService in your grails-app/services directory, you can inject it into a controller using:
def userService
You can override this behavior using the Spring DSL in the resources.groovy file in your grails-app/conf/spring directory. Or if you prefer XML, you can add a resources.xml file in grails-app/conf/spring to configure your Spring Beans.
精彩评论