From 9d01327960b0531da64ae3ffd1b39592830dd425 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 27 Feb 2018 08:54:36 +0100 Subject: some more updates are required to support postgresql databases --- .../config/ConfigurationProvider.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'id/ConfigWebTool') 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 8aab7ef06..abde2089d 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 @@ -35,6 +35,7 @@ import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Properties; import java.util.Timer; import java.util.jar.Attributes; @@ -52,9 +53,8 @@ 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 org.springframework.context.support.GenericApplicationContext; -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; @@ -91,7 +91,7 @@ public class ConfigurationProvider { private boolean pvp2logininitialzied = false; - private ApplicationContext context = null; + private ClassPathXmlApplicationContext context = null; private MOAIDConfigurationModul configModule = null; private NewConfigurationDBRead deprecatedDBRead = null; private FileBasedUserConfiguration userManagement = null; @@ -140,13 +140,15 @@ public class ConfigurationProvider { 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); + GenericApplicationContext rootContext = new GenericApplicationContext(); + +// if (Boolean.valueOf(props.getProperty("configuration.database.byteBasedValues", "false"))) +// activeProfiles.add(SpringProfileConstants.BYTEBASEDCONFIG); +// for (String el: activeProfiles) +// rootContext.getEnvironment().addActiveProfile(el); + + //refresh generic context + rootContext.refresh(); //initialize SpringContext context = new ClassPathXmlApplicationContext( @@ -155,6 +157,10 @@ public class ConfigurationProvider { "moaid.migration.beans.xml", "moaid.configurationtool.beans.xml" }, rootContext); + + + log.info("Spring-context was initialized with active profiles: " + + Arrays.asList(context.getEnvironment().getActiveProfiles())); //Autowire beans in these context AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory(); -- cgit v1.2.3