Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Netbeans RCP with Google Guice

I would like to use Google Guice (2.0 or 3.0, does not matter) for my Netbeans Platform Project. My Project has several Netbeans Modules. I managed to use Guice in a single Netbeans Module, but now I want to Inject a Dependency from one NBModule to another. Is this possible? I googled a lot and searched the mailing lists of netbeans and guice, but it seems like noone ever tried this.

I do not want to use the Lookup API for this, because I really need Dependency Injection for better testing.

Has anyone experiences with that?

Edit: To be more specific: Can i Use the same Injector for all NBModules or do I have to create an Injector for every Module?

like image 314
Dominik Obermaier Avatar asked Oct 25 '22 20:10

Dominik Obermaier


1 Answers

I realize that this question is old, but since the subject is still relevant I decided to share my findings.

We successfully use Google Guice 3.0 in our Netbeans Platform project. This includes injecting dependencies across NBMs using one injector. The only issue we encountered was that Guice didn't recognize annotations in other NBMs, because they were loaded through other classloaders. See http://tkills.blogspot.com/2014/08/using-google-guice-in-netbeans-rcp.html for details.

like image 121
Tarje Avatar answered Oct 27 '22 11:10

Tarje