use of org.springframework.context.support.GenericXmlApplicationContext in project camunda-bpm-platform by camunda.
the class SpringConfigurationHelper method buildProcessEngine.
public static ProcessEngine buildProcessEngine(URL resource) {
log.fine("==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE =========================================");
ApplicationContext applicationContext = new GenericXmlApplicationContext(new UrlResource(resource));
Map<String, ProcessEngine> beansOfType = applicationContext.getBeansOfType(ProcessEngine.class);
if ((beansOfType == null) || (beansOfType.isEmpty())) {
throw new ProcessEngineException("no " + ProcessEngine.class.getName() + " defined in the application context " + resource.toString());
}
ProcessEngine processEngine = beansOfType.values().iterator().next();
log.fine("==== SPRING PROCESS ENGINE CREATED ==================================================================");
return processEngine;
}
use of org.springframework.context.support.GenericXmlApplicationContext in project Activiti by Activiti.
the class SpringConfigurationHelper method buildProcessEngine.
public static ProcessEngine buildProcessEngine(URL resource) {
log.debug("==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE =========================================");
ApplicationContext applicationContext = new GenericXmlApplicationContext(new UrlResource(resource));
Map<String, ProcessEngine> beansOfType = applicationContext.getBeansOfType(ProcessEngine.class);
if ((beansOfType == null) || (beansOfType.isEmpty())) {
throw new ActivitiException("no " + ProcessEngine.class.getName() + " defined in the application context " + resource.toString());
}
ProcessEngine processEngine = beansOfType.values().iterator().next();
log.debug("==== SPRING PROCESS ENGINE CREATED ==================================================================");
return processEngine;
}
use of org.springframework.context.support.GenericXmlApplicationContext in project coprhd-controller by CoprHD.
the class Main method main.
public static void main(String[] args) {
try {
SLF4JBridgeHandler.install();
// To using Spring profile feature
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
ctx.getEnvironment().setActiveProfiles(System.getProperty("buildType"));
ctx.load(args);
ctx.refresh();
ProvisioningService apiservice = (ProvisioningService) ctx.getBean(SERVICE_BEAN);
apiservice.start();
} catch (Exception e) {
_log.error("failed to start {}:", SERVICE_BEAN, e);
System.exit(1);
}
}
use of org.springframework.context.support.GenericXmlApplicationContext in project coprhd-controller by CoprHD.
the class Main method main.
public static void main(String[] args) {
try {
SLF4JBridgeHandler.install();
// To using Spring profile feature
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
ctx.getEnvironment().setActiveProfiles(System.getProperty("buildType"));
ctx.load(args);
ctx.refresh();
DbService dbsvc = (DbService) ctx.getBean(SERVICE_BEAN);
addShutdownHook(dbsvc);
dbsvc.start();
} catch (Exception e) {
_log.error("Failed to start {}:", SERVICE_BEAN, e);
System.exit(1);
}
}
use of org.springframework.context.support.GenericXmlApplicationContext in project coprhd-controller by CoprHD.
the class ApplicationContextUtil method initContext.
public static void initContext(String buildType, String... contextFiles) {
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
ctx.getEnvironment().setActiveProfiles(buildType);
ctx.load(contextFiles);
ctx.refresh();
}
Aggregations