use of org.apache.cloudstack.spring.module.factory.CloudStackSpringContext in project cloudstack by apache.
the class Main method start.
public void start() throws Exception {
CloudStackSpringContext context = new CloudStackSpringContext();
context.registerShutdownHook();
if (Boolean.getBoolean("force.exit")) {
System.exit(0);
}
}
use of org.apache.cloudstack.spring.module.factory.CloudStackSpringContext in project cloudstack by apache.
the class ModuleBasedFilter method init.
@Override
public void init(FilterConfig filterConfig) throws ServletException {
String module = filterConfig.getInitParameter("module");
CloudStackSpringContext context = (CloudStackSpringContext) filterConfig.getServletContext().getAttribute(CloudStackSpringContext.CLOUDSTACK_CONTEXT_SERVLET_KEY);
if (context == null)
return;
ApplicationContext applicationContext = context.getApplicationContextForWeb(module);
if (applicationContext != null) {
AutowireCapableBeanFactory factory = applicationContext.getAutowireCapableBeanFactory();
if (factory != null) {
factory.autowireBean(this);
enabled = true;
}
}
}
use of org.apache.cloudstack.spring.module.factory.CloudStackSpringContext in project cloudstack by apache.
the class CloudStackContextLoaderListener method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent event) {
try {
cloudStackContext = new CloudStackSpringContext();
cloudStackContext.registerShutdownHook();
event.getServletContext().setAttribute(CloudStackSpringContext.CLOUDSTACK_CONTEXT_SERVLET_KEY, cloudStackContext);
} catch (IOException e) {
log.error("Failed to start CloudStack", e);
throw new RuntimeException("Failed to initialize CloudStack Spring modules", e);
}
configuredParentName = event.getServletContext().getInitParameter(WEB_PARENT_MODULE);
if (configuredParentName == null) {
configuredParentName = WEB_PARENT_MODULE_DEFAULT;
}
super.contextInitialized(event);
}
Aggregations