2008/10/17 Miroslav Nachev <[EMAIL PROTECTED]> > Hello Stuart, > > I am little bit familiar with Guice and Peaberry and I can say that I am > not happy to them. If you are familiar with Java EE I would like to compare > Guice and Peaberry with EJB 2.x and Java EE 1.4 where most of > routine/repeated works was done from the programmer and the popularity of > EJB 2.x was not so good. Now with EJB 3 the things are changed because if > you don't want to use some specific configurations you use only few > annotations to create EJB 3.x from POJO bean: @Remote, @Local, @Stateful, > @Stateless. Unfortunately this is not the case with Guice and Peaberry. In > my opinion this improvement can be done only if the dependency injection is > part of OSGi Framework implementation and it will be much better if this is > a part of the OSGi Specification. >
Well I strongly disagree that this can *only* be done by making DI part of the OSGi framework! The success of OSGi has (in part) come from the fact that other frameworks and containers can build on top of the core without bloating it - that's why there's a service registry in the first place. As seen with Spring-DM, iPOJO, etc. it is possible to build a component model on top of OSGi without pushing dependency injection down into the core - and as a counterpoint, what-if EJB3 dependency injection was part of the core and a new approach came out? We'd be left with a load of code that people didn't want to use anymore (especially in the embedded space). Thankfully there are a number of upcoming developments which could help with your use-case, such as the registry hooks - and enhancements to Guice, like possible support for WebBeans: http://groups.google.com/group/google-guice/browse_thread/thread/cc5a03872cea6487 If this falls the right way then it would be possible to use Guice+peaberry+OSGi like you say. PS. as Richard said, in your last example it's very doubtful that any approach would be able to automatically inject an object that's been 'new'd (at least without JVM support) - you would need another step, like Guice's injectMembers method. Regards, > Miro. -- Cheers, Stuart

