-
Notifications
You must be signed in to change notification settings - Fork 179
Spring, PicoContainer, Etc.
Randgalt edited this page Oct 26, 2012
·
5 revisions
Governator can be used in a Spring, PicoContainer or similar project in the following way:
LifecycleListener lifecycleListener = new LifecycleListener()
{
@Override
public void objectInjected(Object obj)
{
// context is an ApplicationContext
context.getBeanFactory().registerSingleton(obj.getClass().getName(), obj);
}
@Override
public void stateChanged(Object obj, LifecycleState newState)
{
}
};
See LifecycleListener for details.
MyClass m = context.getBeanFactory().getBean(MyClass.class);
LifecycleListener lifecycleListener = new LifecycleListener()
{
@Override
public void objectInjected(Object obj)
{
// container is a MutablePicoContainer
container.addComponent(obj);
}
@Override
public void stateChanged(Object obj, LifecycleState newState)
{
}
};
See LifecycleListener for details.
MyClass m = container.getComponent(MyClass.class);
- Home
- Getting Started
- Bootstrapping
- Lifecycle Management
- Auto Binding
- Module-Dependencies
- Warm Up
- Configuration Mapping
- Field Validation
- Lazy Singleton
- Concurrent Singleton
- Generic Binding Annotations
- LifecycleListener
- Governator Phases
- Grapher Integration
- JUnit Testing
- FAQ
- Best Practices
- Spring, PicoContainer, Etc.
- Javadoc
- End-to-End Examples