Discussions

News: peaberry 1.0-rc1: Dynamic service extension for Guice

  1. I'm pleased to announce the first release candidate of peaberry, an extension library for Guice that supports dependency injection of dynamic services. It provides OSGi integration out of the box, and has plug-in support for other registry-based service frameworks. It ships as an OSGi bundle that can be dropped into any R4 framework, such as Apache Felix or Eclipse/Equinox. Let's look at some examples, here the service, export, iterable and methods are static imports: import static org.ops4j.peaberry.Peaberry.service; import static org.ops4j.peaberry.util.TypeLiterals.export; import static org.ops4j.peaberry.util.TypeLiterals.iterable; Injecting a stock quote service @Inject StockQuote quote; ... bind(StockQuote.class).to(service(StockQuote.class).single()); Injecting many stock quote services @Inject Iterable quotes; ... bind(iterable(StockQuote.class)).to(service(StockQuote.class).multiple()); Exporting an implementation as a stock quote service @Inject Export exportedQuote; ... bind(export(StockQuote.class)).to(service(myQuoteImpl).export()); Watching for a stock quote service @Inject StockQuote quote; ... // the watching scope is notified as stock services are added, modified, or removed bind(StockQuote.class).to(service(StockQuote.class).out(watchingScopeImpl).single()); More examples can be found here. Please report any bugs on the issues page, or feel free to join the discussion group.
  2. Guice-Peaberry vs Spring-DM benchmark: http://code.google.com/p/peaberry/wiki/Benchmarks