diff --git a/wise-webapp/src/main/java/com/wisemapping/webmvc/ApplicationContextInitializer.java b/wise-webapp/src/main/java/com/wisemapping/webmvc/ApplicationContextInitializer.java new file mode 100644 index 00000000..91d2cfef --- /dev/null +++ b/wise-webapp/src/main/java/com/wisemapping/webmvc/ApplicationContextInitializer.java @@ -0,0 +1,52 @@ +/* +* Copyright [2012] [wisemapping] +* +* Licensed under WiseMapping Public License, Version 1.0 (the "License"). +* It is basically the Apache License, Version 2.0 (the "License") plus the +* "powered by wisemapping" text requirement on every single page; +* you may not use this file except in compliance with the License. +* You may obtain a copy of the license at +* +* http://www.wisemapping.org/license +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.wisemapping.webmvc; + + +import org.jetbrains.annotations.NotNull; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.core.env.PropertiesPropertySource; +import org.springframework.core.env.PropertySourcesPropertyResolver; +import org.springframework.core.io.Resource; +import org.springframework.core.io.UrlResource; +import org.springframework.core.io.support.ResourcePropertySource; +import org.springframework.web.context.ConfigurableWebApplicationContext; +import org.springframework.web.context.support.ServletContextResource; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +public class ApplicationContextInitializer implements org.springframework.context.ApplicationContextInitializer { + + public void initialize(@NotNull ConfigurableWebApplicationContext ctx) { + try { + final Resource resource = new ServletContextResource(ctx.getServletContext(), "/WEB-INF/app.properties"); + final ResourcePropertySource resourcePropertySource = new ResourcePropertySource(resource); + ctx.getEnvironment().getPropertySources().addFirst(resourcePropertySource); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } + +} \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties index 9dc15ca7..b631cbca 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -100,7 +100,7 @@ google.analytics.account=UA-XXXX google.ads.enabled=false ####################################################################################### -Security Configuration Section +# Authentication Configuration Section ####################################################################################### # Two type of security are supported: diff --git a/wise-webapp/src/main/webapp/WEB-INF/web.xml b/wise-webapp/src/main/webapp/WEB-INF/web.xml index aba7687c..c8182dc3 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/web.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/web.xml @@ -22,6 +22,11 @@ + + contextInitializerClasses + com.wisemapping.webmvc.ApplicationContextInitializer + + - - + + +