Example usage for org.springframework.web.context.support GenericWebApplicationContext getEnvironment

List of usage examples for org.springframework.web.context.support GenericWebApplicationContext getEnvironment

Introduction

In this page you can find the example usage for org.springframework.web.context.support GenericWebApplicationContext getEnvironment.

Prototype

@Override
public ConfigurableEnvironment getEnvironment() 

Source Link

Document

Return the Environment for this application context in configurable form, allowing for further customization.

Usage

From source file:fr.letitzen.demo.web.GenericWebXmlContextLoader.java

public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
    GenericWebApplicationContext context = new GenericWebApplicationContext();
    context.getEnvironment().setActiveProfiles(mergedConfig.getActiveProfiles());
    prepareContext(context);/*ww w .ja v  a2s .  c  o m*/
    new XmlBeanDefinitionReader(context).loadBeanDefinitions(mergedConfig.getLocations());
    AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
    context.refresh();
    context.registerShutdownHook();
    return context;
}

From source file:com.example.springsecurity.web.controllers.GenericWebContextLoader.java

public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
    GenericWebApplicationContext context = new GenericWebApplicationContext();
    context.getEnvironment().setActiveProfiles(mergedConfig.getActiveProfiles());
    prepareContext(context);/* w w  w.  ja  v  a 2 s .c o m*/
    loadBeanDefinitions(context, mergedConfig);
    return context;
}

From source file:mx.edu.um.mateo.general.test.GenericWebXmlContextLoader.java

@Override
public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
    GenericWebApplicationContext context = new GenericWebApplicationContext();
    context.getEnvironment().setActiveProfiles(mergedConfig.getActiveProfiles());
    prepareContext(context);//from  w  w w  . j a v  a2s .  com
    new XmlBeanDefinitionReader(context).loadBeanDefinitions(mergedConfig.getLocations());
    AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
    context.refresh();
    context.registerShutdownHook();
    return context;
}