Component Lifecycle

Waffle provides lifecycle support which means we can register component with the Registrar that implement org.codehaus.waffle.Startable. This will allow a component to be started as soon as a context (application, session or request) is initialized and stopped when the context is destroyed. This is an extremly useful and powerful ability. With this feature it is possible to register "Janitor" type of components that will cleanup resources when their particular context is being destroyed (i.e. closing jdbc resources).

Startable components are registered in the same way as any other component or Controllers within Waffle. And of course they will also support Dependency Injection, otherwise your Startable components would be no more useful than the example above.