FELIX-1995: Spring status does not show properly after osgi:list command

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@900715 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/shell/osgi/src/main/java/org/apache/felix/karaf/shell/osgi/SpringStateListenerFactory.java b/karaf/shell/osgi/src/main/java/org/apache/felix/karaf/shell/osgi/SpringStateListenerFactory.java
index 50135b3..b9f8a24 100644
--- a/karaf/shell/osgi/src/main/java/org/apache/felix/karaf/shell/osgi/SpringStateListenerFactory.java
+++ b/karaf/shell/osgi/src/main/java/org/apache/felix/karaf/shell/osgi/SpringStateListenerFactory.java
@@ -64,7 +64,11 @@
 
     private BundleStateListener createListener() {
         try {
-            return new SpringApplicationListener(bundleContext);
+            // Use dynamic class loading to make sure we actually try to reload the class for
+            // dynamic imports to kick in   if possible
+            Class cl = getClass().getClassLoader().loadClass("org.apache.felix.karaf.shell.osgi.SpringStateListenerFactory$SpringApplicationListener");
+            return (BundleStateListener) cl.getConstructor(BundleContext.class).newInstance(bundleContext);
+//            return new SpringApplicationListener(bundleContext);
         } catch (Throwable t) {
             return null;
         }