java - How to do Constructor Dependency Injection in Netbeans Platform -
i'm asking myself while how cdi in netbeans platform topcomponents or subclasses of them. i'm using lookups dependencies , inter-module-communication , it's working fine, dependencies of components not visible outside using cdi i'm searching way populate constructors of topcomponents right arguments (loose-coupled trough interface types). using 3 modules:
- api - contains interfaces
- core - contains implementations of interfaces, have api dependency
- gui - contains gui , logic code encapsulated in topcomponents have dependency on api
as see both modules (gui , core) rely on api because of loose-coupling in modular system. think nice use lookups find right implementations interfaces in api said want have dependencies visible outside of component classes.
so there way doing constructor dependency injection in modular loose-coupled architecture using netbeans platform(version 8.0.2) , if yes how?
if no best solution provide clear view on dependencies of component classes?
any appreciated.
i think found solution solves part of problem. topcomponents getting accessed trough
window -> topcomponentnamehere
action (which generated annotations use topcomponent?).
the thought can initialize topcomponent inside of actions , show them too. here use simple new statement create object of topcomponent want show. here point: can load components dependencies before via lookups , pass them directly constructor (in eyes not full solution because action has initialize topcomponent, however).
i think way more beautiful grabbing dependencies right in component initialization code , enough moment me live with.
Comments
Post a Comment