private void initSpringConfig(SpringConfiguration springConfiguration, Environment environment) {


        logger.info("Using configurations: {}", join(springConfiguration.getApplicationContext(), ", "));


        SpringPropertyPlaceholderConfigurerConfiguration propConfig =
                springConfiguration.getPlaceholderConfiguration();

        //If the YAML File defines property locations, or properties directly for us to inject
        // into the spring context files we are loading, we create the PropertyPlaceholderConfigurer
        if (propConfig!=null) {
            PropertyPlaceholderConfigurer configurer = propConfig.createPlaceholderConfigurer(applicationContext);
            applicationContext.getBeanFactory().registerSingleton("fallWizardProperties", configurer);
        }

        // ------------------------------
        // Load Profiles
        // ------------------------------
        // If Spring Bean Profiles are defined, register the profiles.
        if (springConfiguration.getBeanProfiles() != null){
            logger.info("Using profiles: {}", join(springConfiguration.getBeanProfiles(), ", "));
            applicationContext.getEnvironment()
                    .setActiveProfiles(springConfiguration.getBeanProfiles());
        }

        // ------------------------------
        // Load Application Context Files
        // ------------------------------
        for (String applicationContextFile : springConfiguration.getApplicationContext()){

            applicationContext.load(
                    normalizeForResourceLocation(applicationContextFile));
        }

        applicationContext.refresh();

        // ------------------------------
        // SpringSecurity Considerations
        // ------------------------------
        // If we should use Spring Security
        if (springConfiguration.shouldUseSpringSecurity()){
            final XmlWebApplicationContext wctx = new XmlWebApplicationContext();
            wctx.setParent(applicationContext);
            wctx.setConfigLocation("");
            wctx.refresh();
            environment.servlets().addServletListeners(new ServletContextListener() {

                @Override
                public void contextInitialized(ServletContextEvent servCtx) {
                    servCtx.getServletContext()
                            .setAttribute(
                                    WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                                    wctx);
                    wctx.setServletContext(servCtx.getServletContext());

                }

                @Override
                public void contextDestroyed(ServletContextEvent arg0) {
                    // TODO Auto-generated method stub

                }
            });
            // Register the Spring Security Auth Provider
            new SpringSecurityAuthProvider(applicationContext)
                    .registerProvider(environment);
        }

    }