FELIX-4753 fix startup timing issue, patch thanks to Thomas Watson

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1649864 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
index d7994d3..f6ee3ec 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfiguration.java
@@ -127,11 +127,16 @@
         props.put(Constants.SERVICE_PID, PID);
         props.put(Constants.SERVICE_DESCRIPTION, "SCR Configurator");
         props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+
+
+        // Process configure from bundle context properties so they can be predictably
+        // overriden by configuration admin later.
+        // Note that if the managed service is registered first then it is random which will win since
+        // configuration may be delivered asynchronously
+        configure( null, false );            
+
         managedService = ( ServiceRegistration<ManagedService> ) bundleContext.registerService("org.osgi.service.cm.ManagedService", new ScrManagedServiceServiceFactory(this),
             props);
-        
-        // configure from bundle context properties
-        configure( null, false );            
     }
 
     public void stop() {