Composition

PicoContainer Web composition is abstracted via the WebappComposer interface, which defines how components are registered at the different webapp scopes - application, session and request. Typically, request-scoped components are 'actions'.

	public class ExampleWebappComposer implements WebappComposer {

	    public void composeApplication(MutablePicoContainer appContainer) {
	        appContainer.addComponent(CheeseDao.class, InMemoryCheeseDao.class);
	    }

	    public void composeSession(MutablePicoContainer sessionContainer) {
	        sessionContainer.addComponent(CheeseService.class, DefaultCheeseService.class);
	    }

	    public void composeRequest(MutablePicoContainer requestContainer) {
		    // for Struts1 & 2 and Webwork 1 & 2 the request level components are added lazily
		    // as they have their own XML for defining action mappings.
	    }
	}