dependency injection - What if I want to have my own plug-in architecture within Grails? -


Let's say I want to define an interface, a duplicate, and then many implementations of the interface available on runtime (maybe even as personal services). In my controller class, I want to be able to make all known implementations of this interaction interface on runtime so that I can highlight the user as "option" to get different types of "foo" items. This will allow my server-side code to be more modular and many people will be allowed to define different ways of plugging in the phupro provider services.

What I see, Grails only gives me the option of an injection. Example of a service implementation in my controller / domain classes Grails is a way to injection multiple instances of a service based on an interface type ? I think I am parallel with the ability to inject the implementation of an interface available in OSGi's OSGi container ... any ideas?

Grails uses spring below, so that you can inject many services in your controller like you Whether you know Spring

But I think there is a possible reason to do this. When you start putting many services in the controller, it is the controller, on which they take the order, in which they are called. It seems like a workflow to me at that time, something that is best left in a service.

Controllers are part of the web level. You can not open that process in front of the client which comes through a channel other than the web-level if it is buried in the controller.

I recommend that you do not do this, even if this is possible. It seems like a complicated use case in another service that a better idea would have to be revealed. Explain it and hide details from customers. These are the things - hide complication.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -