Example usage for org.springframework.web.context WebApplicationContext getBean

List of usage examples for org.springframework.web.context WebApplicationContext getBean

Introduction

In this page you can find the example usage for org.springframework.web.context WebApplicationContext getBean.

Prototype

Object getBean(String name) throws BeansException;

Source Link

Document

Return an instance, which may be shared or independent, of the specified bean.

Usage

From source file:org.cleverbus.core.conf.CheckingConfMessageDispatcherServlet.java

@Override
protected WebApplicationContext initWebApplicationContext() {
    WebApplicationContext webApplicationContext = super.initWebApplicationContext();

    webApplicationContext.getBean(ConfigurationChecker.class).checkConfiguration(webApplicationContext);

    return webApplicationContext;
}

From source file:com.github.clboettcher.bonappetit.server.jersey.ServerApplication.java

public ServerApplication() {
    LOGGER.info(String.format("Initializing Jersey application."));
    final WebApplicationContext ctx = ContextLoader.getCurrentWebApplicationContext();
    register(ctx.getBean(HeartbeatService.class));
}

From source file:org.teavm.flavour.example.server.JerseyInitializer.java

public JerseyInitializer() {
    WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
    register(context.getBean(ProductFacade.class));
}

From source file:org.LexGrid.LexBIG.caCore.web.util.LexEVSJSPUtils.java

public LexEVSJSPUtils(ServletContext context) {
    super(context);
    WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(context);
    dbConnector = (DBConnector) ctx.getBean("DBConnector");

}

From source file:org.sakaiproject.imagegallery.web.ReasonableRsacServlet.java

@Override
public void init(ServletConfig config) {
    ServletContext sc = config.getServletContext();
    WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(sc);
    rsacbeanlocator = (RSACBeanLocator) wac.getBean(RSACBeanLocator.RSAC_BEAN_LOCATOR_NAME);
}

From source file:com.ewcms.component.hot.web.JavaScriptServlet.java

private HotService getHotService() {
    ServletContext application = getServletContext();
    WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(application);
    return (HotService) wac.getBean("hotService");
}

From source file:com.ewcms.component.online.web.servlate.JavaScriptServlet.java

private OnlineService getOnlineService() {
    ServletContext application = getServletContext();
    WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(application);
    return (OnlineService) wac.getBean("onlineService");
}

From source file:com.ewcms.component.citizen.web.servlate.JavaScriptServlet.java

private CitizenService getCitizenService() {
    ServletContext application = getServletContext();
    WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(application);
    return (CitizenService) wac.getBean("citizenService");
}

From source file:org.brekka.paveway.web.servlet.AbstractPavewayServlet.java

protected PavewayService initPavewayService() {
    WebApplicationContext applicationContext = WebApplicationContextUtils
            .getWebApplicationContext(getServletContext());
    return applicationContext.getBean(PavewayService.class);
}

From source file:ar.com.zauber.commons.spring.beans.factory.impl.ContextPathRegexCaseBlockTest.java

/** test */
public final void testCtxHome() {
    final MockServletContext servletCtx = new MockServletContext("/home");
    servletCtx.addInitParameter("contextConfigLocation", "classpath:/spring-test-switch-regex.xml");
    final TestFriendlyContextLoaderListener listener = new TestFriendlyContextLoaderListener();
    listener.contextInitialized(new ServletContextEvent(servletCtx));

    final WebApplicationContext ctx = ((TestFriendlyContextLoader) listener.getContextLoader()).getCtx();

    assertEquals("home", ctx.getBean("test1"));
}