picocontainer

How do I manage dynamic dependencies with PicoContainer?

Say I have two classes A and B, with B depending on A. public class A {} public class B { public B(A a) {} } It's easy to resolve B in a single PicoContainer. final MutablePicoContainer root = new PicoBuilder().build(); root.addComponent(new A()); root.addComponent(B.class, B.class); System.out.println(root.getCo...

Converting from Waffle/Pico to Struts2/Guice

Hi all, I've been tasked with converting an application which was developed by myself in the Waffle Framework using PicoContainer as a DI mechanism into our new "stack" which is to use Struts2 as a framework with Guice as the DI mechanism. Does anyone out there have any helpful pointers as to how to do this with minimal pain and at the...

IllegalStateException shutting down webapp with PicoContainer

I have a Java webapp that's using PicoContainer for dependency injection. When I shut down the app, I sometimes get the following stack trace repeated a few times in my error log: 2009-11-18 17:32:29,352 ERROR [/] - Session event listener threw exception java.lang.IllegalStateException: Cannot stop. Current container state was: STARTE...

How to register decorated objects in Dependency Injection frameworks (PicoContainer) ?

Hi, I want to wrap a number of classes implementing the Job interface with a JobEnabledDecorator object that determines whether or not it executes. I am having trouble figuring out how to configure this in PicoContainer, so that it knows to create the Job implementation objects with a JobEnabledDecorator wrapping them. Is this possi...

Google Guice vs. PicoContainer for Dependency Injection

My team is researching dependency injection frameworks and is trying to decide between using Google-Guice and PicoContainer. We are looking for several things in our framework: A small code footprint - What I mean by a small code footprint is we don't want to have dependency injection code litter everywhere in our code base. If we ne...

Controlling the order of PicoContainer startup

I have been tasked with doing some refactoring work on how we start up applications. Basically we have a bunch of console apps which were depending on the GUI application startup code, causing bogus dependencies which have kick-on effects for which libraries we need to ship, and which dependencies other modules need to declare. So I ha...

Can I stop PicoContainer closing a certain component in the container?

We're using PicoContainer to manage lifecycle events for multiple components. We have a custom lifecycle strategy which adds support for calling Closeable.close() instead of Disposable.dispose(), just to follow standards that little bit better. Some of the components depend on an external object, so this component is also in the conta...