/*
 * Copyright 2015-2016 Canoo Engineering AG.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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.canoo.dolphin.server.spring;

import com.canoo.dolphin.server.bootstrap.DolphinPlatformBootstrap;
import com.canoo.dolphin.server.config.ConfigurationFileLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.embedded.ServletContextInitializer;
import org.springframework.context.annotation.Configuration;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

/**
 * Basic Bootstrap for Spring based application. The bootstrap automatically starts the dolphin platform bootstrap.
 *
 * @author Hendrik Ebbers
 */
@Configuration
public class DolphinPlatformSpringBootstrap implements ServletContextInitializer {

    private static final Logger LOG = LoggerFactory.getLogger(DolphinPlatformSpringBootstrap.class);

    @Override
    public void onStartup(final ServletContext servletContext) throws ServletException {
        DolphinPlatformBootstrap.start(servletContext, ConfigurationFileLoader.loadConfiguration());
    }
}

@@ -773,24 +773,93 @@
 FileLoader;%0A
+import com.canoo.dolphin.server.config.DolphinPlatformConfiguration;%0A
 import org.s
@@ -903,16 +903,65 @@
 actory;%0A
+import org.springframework.beans.BeansException;%0A
 import o
@@ -1024,24 +1024,221 @@
 nitializer;%0A
+import org.springframework.boot.context.properties.EnableConfigurationProperties;%0Aimport org.springframework.context.ApplicationContext;%0Aimport org.springframework.context.ApplicationContextAware;%0A
 import org.s
@@ -1532,16 +1532,80 @@
 uration%0A
+@EnableConfigurationProperties(DolphinPlatformProperties.class)%0A
 public c
@@ -1676,16 +1676,41 @@
 tializer
+, ApplicationContextAware
  %7B%0A%0A    
@@ -1807,16 +1807,244 @@
 lass);%0A%0A
+    private ApplicationContext applicationContext;%0A%0A    @Override%0A    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException %7B%0A        this.applicationContext = applicationContext;%0A    %7D%0A%0A
     @Ove
@@ -2165,39 +2165,37 @@
 form
-Bootstrap.start(servletContext,
+Configuration configuration =
  Con
@@ -2234,16 +2234,155 @@
 ration()
+;%0A%0A        final DolphinPlatformBootstrap bootstrap = new DolphinPlatformBootstrap(servletContext, configuration);%0A        bootstrap.start(
 );%0A    %7D

create Bootstrap