corrected app context generation
authorCherian Mathew <c.mathew@bgbm.org>
Tue, 26 May 2015 16:23:57 +0000 (18:23 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Tue, 26 May 2015 16:23:57 +0000 (18:23 +0200)
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java

index 7254c2de1537825e084e03b95b73f65c1349966c..77c994b2efe3cafc5af97d6b9cb7b25096c0c9c8 100644 (file)
@@ -134,16 +134,10 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
         logger.info("Connecting to '" + remoteSource.getName() + "'");
 
         GenericApplicationContext applicationContext
-            = generateApplicationContext(applicationContextResource, listeners, progressMonitor, false);
+            = generateApplicationContext(remoteSource, applicationContextResource, listeners, progressMonitor, false);
+
 
 
-        PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
-        Properties properties = new Properties();
-        properties.setProperty("remoteServer", remoteSource.getServer());
-        properties.setProperty("remotePort", String.valueOf(remoteSource.getPort()));
-        properties.setProperty("remoteContext", remoteSource.getContextPath());
-        pspc.setProperties(properties);
-        applicationContext.addBeanFactoryPostProcessor(pspc);
         //progressMonitor.beginTask("Connecting to '" + remoteSource.getName() + "'", nTasks);
         applicationContext.refresh();
         applicationContext.start();
@@ -157,7 +151,8 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
         return true;
     }
 
-    public static GenericApplicationContext generateApplicationContext(Resource applicationContextResource,
+    public static GenericApplicationContext generateApplicationContext(ICdmRemoteSource remoteSource,
+            Resource applicationContextResource,
             List<ApplicationListener> listeners,
             IProgressMonitor progressMonitor,
             boolean validateXml) {
@@ -169,6 +164,14 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
         applicationContext.getEnvironment().setActiveProfiles("remoting");
         progressMonitor.worked(1);
 
+        PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
+        Properties properties = new Properties();
+        properties.setProperty("remoteServer", remoteSource.getServer());
+        properties.setProperty("remotePort", String.valueOf(remoteSource.getPort()));
+        properties.setProperty("remoteContext", remoteSource.getContextPath());
+        pspc.setProperties(properties);
+        applicationContext.addBeanFactoryPostProcessor(pspc);
+
         XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext);
         if(!validateXml) {
             xmlReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);