Example usage for org.springframework.context.support GenericApplicationContext isActive

List of usage examples for org.springframework.context.support GenericApplicationContext isActive

Introduction

In this page you can find the example usage for org.springframework.context.support GenericApplicationContext isActive.

Prototype

@Override
    public boolean isActive() 

Source Link

Usage

From source file:org.openspaces.admin.application.ApplicationFileDeployment.java

private static <T> T getSpringBeanFromResource(Resource resource, Class<T> type) throws BeansException {
    final GenericApplicationContext context = new GenericApplicationContext();
    try {//  ww  w . j  av a2  s  .  c o  m
        final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
        xmlReader.loadBeanDefinitions(resource);
        context.refresh();
        return context.getBean(type);
    } finally {
        if (context.isActive()) {
            context.close();
        }
    }
}