aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
index c5ae5065f..8aab7ef06 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
@@ -34,6 +34,7 @@ import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
+import java.util.ArrayList;
import java.util.Properties;
import java.util.Timer;
import java.util.jar.Attributes;
@@ -51,7 +52,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.web.context.support.GenericWebApplicationContext;
+import at.gv.egovernment.moa.id.commons.config.SpringProfileConstants;
import at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead;
import at.gv.egovernment.moa.id.commons.ex.MOAHttpProtocolSocketFactoryException;
import at.gv.egovernment.moa.id.commons.utils.MOAHttpProtocolSocketFactory;
@@ -93,6 +96,8 @@ public class ConfigurationProvider {
private NewConfigurationDBRead deprecatedDBRead = null;
private FileBasedUserConfiguration userManagement = null;
+ private ArrayList<String> activeProfiles = new ArrayList<String>();
+
public static ConfigurationProvider getInstance() throws ConfigurationException {
if (instance == null) {
@@ -134,12 +139,24 @@ public class ConfigurationProvider {
props.load(fis);
fis.close();
+ //initialize generic SpringContext to set profiles
+ GenericWebApplicationContext rootContext = new GenericWebApplicationContext();
+ if (Boolean.valueOf(props.getProperty("configuration.database.byteBasedValues", "false")))
+ activeProfiles.add(SpringProfileConstants.BYTEBASEDCONFIG);
+
+ log.info("Activate SpingProfiles: " + activeProfiles.toString());
+ for (String el: activeProfiles)
+ rootContext.getEnvironment().addActiveProfile(el);
+
+ //initialize SpringContext
context = new ClassPathXmlApplicationContext(
new String[] { "configuration.beans.xml",
"moaid.webgui.beans.xml",
"moaid.migration.beans.xml",
"moaid.configurationtool.beans.xml"
- });
+ }, rootContext);
+
+ //Autowire beans in these context
AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory();
acbFactory.autowireBean(this);