[ https://issues.apache.org/jira/browse/PIVOT-885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13576872#comment-13576872 ]
Karel Hübl commented on PIVOT-885: ---------------------------------- I made prototype of simple java (client) to java (server) RMI using HTTP. This mades me reimplement DI to be usable on server side and independent on Pivot collections. Change in dependency injection and BeanFactory The main change is, change of BeanInjector.injectDependencies method signature. Instead of passing Pivot namespace as parameter (the only dependency on Pivot collections), InjectorEventDispatcher is passed. InjectorEventDispatcher enables registration of InjectionListers. This is used by InjectionSerialiser (deployed only on client) to add injected properties to namespace. Transparent service invocation and RMI Business logic is typically implemented by service layer. Business layer interface should be represented by set of service interfaces. In enterprise environment, I believe, pivot is targeted as GUI for thin clients, so implementation of service layer is deployed on server (typically J2EE). In development phase it may be usefull to not depend on server part (use mock services) or do not wait for redeployment of server layer. And sometimes we may want to implement thick clients. So our Pivot App should depend on service interfaces - and service implementation may be injected in runtime based on configuration. The provided implementation may be mock, service instance or service delegate instance handling RMI. I propose @Service annotation to mark fields for injection of services. RemoteServiceProxyFactory is prototype of ServiceFactory providing dynamic service delegate proxies handling RMI of services on J2EE server over HTTP. RMIServlet can be used as prototype endpoint. I am attachinng my proposals to extend Pivot in above areas in attached archived eclipse projects. There is very simple Pivot application demonstrating proposed features in extensions-sample.zip. In extensions-sample-client\src\org\apache\pivot\extensionsSample\launcher are executable launchers with diferent configs (mock, local, dynamic service delegate proxy). > Add support for dependecy injection > ----------------------------------- > > Key: PIVOT-885 > URL: https://issues.apache.org/jira/browse/PIVOT-885 > Project: Pivot > Issue Type: New Feature > Reporter: Karel Hübl > Assignee: Sandro Martini > Fix For: 2.1 > > Attachments: extensions-sample.zip, pivot-extensions.zip > > > As pivot application devoloper, I would like to have support for dependency > injection in Pivot. My requirements are: > - support for field injection (at least) > - support for @PostConstruct methods > - support for @RuntimeScoped classes - only one instance may be constructed > during Runtime. Usefull when one needs share injected instances. > - in relevant cases, inject dependencies also into namespace. > I implemented prototype of this functionality, source codes including unit > tests and sample application are included. The dependency injection is > implemented in proposed org.apache.pivot.beans.injection package. > Please consider adding this functionality in future Pivot release. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira