Detect whether the BeanManager in PlexusSpaceModule is a delegate or a replacement for the PlexusLifecycleManager
diff --git a/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusSpaceModule.java b/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusSpaceModule.java
index 2664548..ac78a1c 100644
--- a/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusSpaceModule.java
+++ b/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusSpaceModule.java
@@ -83,9 +83,11 @@
binder.bind( PlexusBeanLocator.class ).to( DefaultPlexusBeanLocator.class );
binder.bind( PlexusContainer.class ).to( PseudoPlexusContainer.class );
- final BeanManager manager = new PlexusLifecycleManager( binder.getProvider( Context.class ), //
- binder.getProvider( LoggerManager.class ), //
- slf4jLoggerFactoryProvider, delegate );
+ final BeanManager manager =
+ delegate instanceof PlexusLifecycleManager ? delegate
+ : new PlexusLifecycleManager( binder.getProvider( Context.class ),
+ binder.getProvider( LoggerManager.class ),
+ slf4jLoggerFactoryProvider, delegate );
binder.bind( BeanManager.class ).toInstance( manager );