List of usage examples for org.springframework.web.context.support AnnotationConfigWebApplicationContext AnnotationConfigWebApplicationContext
AnnotationConfigWebApplicationContext
From source file:http2.Main.java
public static void main(String[] args) throws Exception { AnnotationConfigWebApplicationContext cxt = new AnnotationConfigWebApplicationContext(); cxt.register(WebConfig.class); DispatcherServlet dispatcherServlet = new DispatcherServlet(cxt); Server server = new Server(); ServletContextHandler context = new ServletContextHandler(); context.setResourceBase("src/main/webapp"); context.addServlet(new ServletHolder("default", DefaultServlet.class), ""); context.addServlet(new ServletHolder(dispatcherServlet), "/"); context.addFilter(new FilterHolder(new PushCacheFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); server.setHandler(context);//from w w w.j av a 2 s .c o m HttpConfiguration httpConfig = new HttpConfiguration(); httpConfig.setSecureScheme("https"); httpConfig.setSecurePort(8443); httpConfig.setSendXPoweredBy(true); httpConfig.setSendServerVersion(true); HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); httpsConfig.addCustomizer(new SecureRequestCustomizer()); ServerConnector httpConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfig)); httpConnector.setPort(8080); server.addConnector(httpConnector); ServerConnector http2Connector = createHttp2Connector(server, httpsConfig); http2Connector.setPort(8443); server.addConnector(http2Connector); ALPN.debug = true; server.start(); server.dumpStdErr(); server.join(); }
From source file:com.indoqa.osgi.embedded.sample.webapp.WebappIntiallizer.java
private static AnnotationConfigWebApplicationContext initializeSpringApplicationContext( ServletContext servletContext) { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.setServletContext(servletContext); context.scan("com.indoqa.osgi.embedded.sample"); context.refresh();//from w w w. j a v a 2s .c o m return context; }
From source file:ip.ip.rest.config.WebAppInitializer.java
public void onStartup(javax.servlet.ServletContext sc) throws javax.servlet.ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(ApplicationConfig.class); ctx.setServletContext(sc);// w w w .j ava 2 s .c om ServletRegistration.Dynamic dynamic = sc.addServlet("dispatcher", new DispatcherServlet(ctx)); dynamic.addMapping("/"); dynamic.setLoadOnStartup(1); }
From source file:com.chuangtc.config.SpringWebInitializer.java
public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(AppConfig.class); ctx.setServletContext(servletContext); Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1);/*from w w w.j a v a2 s.co m*/ }
From source file:com.chevres.config.WebInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(servletContext); Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1);//ww w .j a v a2s . c o m }
From source file:com.shadows.liquiblq.webapi.config.WebAppInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(AppConfig.class); ctx.setServletContext(servletContext); Dynamic dynamic = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dynamic.addMapping("/"); dynamic.setLoadOnStartup(1);// www . j a va 2s.c om }
From source file:com.se.configuracion.WebInitializer.java
@Override public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(sc);//w w w .java 2 s. c om Dynamic servlet = sc.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
From source file:com.mycompany.config.WebInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(servletContext); ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1);/*from www . ja v a 2 s .co m*/ }
From source file:com.sbtn.spring.config.WebInitializer.java
@Override public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(sc);/*from w w w .j a va2s . c o m*/ Dynamic servlet = sc.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
From source file:com.mycompany.comerciobici.controlador.InicializadorRest.java
public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(CargadorApplicacion.class); ctx.setServletContext(servletContext); ServletRegistration.Dynamic dynamic = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dynamic.addMapping("/"); dynamic.setLoadOnStartup(1);//from w ww . j av a 2s . co m }