List of usage examples for org.springframework.context ConfigurableApplicationContext setParent
void setParent(@Nullable ApplicationContext parent);
From source file:org.dspace.app.rest.utils.DSpaceKernelInitializer.java
@Override public void initialize(final ConfigurableApplicationContext applicationContext) { // Check if the kernel is already started this.dspaceKernel = DSpaceKernelManager.getDefaultKernel(); if (this.dspaceKernel == null) { DSpaceKernelImpl kernelImpl = null; try {/* w w w . j a v a 2 s . c om*/ // Load the kernel with default settings kernelImpl = DSpaceKernelInit.getKernel(null); if (!kernelImpl.isRunning()) { // Determine configured DSpace home & init the Kernel kernelImpl.start(getDSpaceHome(applicationContext.getEnvironment())); } this.dspaceKernel = kernelImpl; } catch (Exception e) { // failed to start so destroy it and log and throw an exception try { if (kernelImpl != null) { kernelImpl.destroy(); } this.dspaceKernel = null; } catch (Exception e1) { // nothing } String message = "Failure during ServletContext initialisation: " + e.getMessage(); log.error(message, e); throw new RuntimeException(message, e); } } if (applicationContext.getParent() == null) { // Set the DSpace Kernel Application context as a parent of the Spring Boot context so that // we can auto-wire all DSpace Kernel services applicationContext.setParent(dspaceKernel.getServiceManager().getApplicationContext()); //Add a listener for Spring Boot application shutdown so that we can nicely cleanup the DSpace kernel. applicationContext.addApplicationListener(new DSpaceKernelDestroyer(dspaceKernel)); } }
From source file:org.mule.config.spring.SpringRegistry.java
public SpringRegistry(ConfigurableApplicationContext applicationContext, ApplicationContext parentContext, MuleContext muleContext) {/*from w ww . j a va 2 s . c o m*/ super(REGISTRY_ID, muleContext); applicationContext.setParent(parentContext); setApplicationContext(applicationContext); }
From source file:org.mule.config.spring.SpringRegistry.java
public SpringRegistry(String id, ConfigurableApplicationContext applicationContext, ApplicationContext parentContext, MuleContext muleContext) { super(id, muleContext); applicationContext.setParent(parentContext); setApplicationContext(applicationContext); }