List of usage examples for org.springframework.web.context.support AnnotationConfigWebApplicationContext scan
public void scan(String... basePackages)
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 ww. j a va2 s. com*/ return context; }
From source file:com.bitran.config.Inicializador.java
@Override public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.scan("com.bitran"); sc.addListener(new ContextLoaderListener(ctx)); Dynamic servlet = sc.addServlet("appServlet", new DispatcherServlet(ctx)); servlet.setAsyncSupported(true);//from ww w . ja va2s .com servlet.setLoadOnStartup(1); servlet.addMapping("*.action"); }
From source file:cn.ifast.oauth2server.config.ServletInitializer.java
@Override protected WebApplicationContext createServletApplicationContext() { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.scan(ClassUtils.getPackageName(getClass())); return context; }
From source file:at.ac.tuwien.infosys.configuration.WebAppInitializer.java
@Override public void onStartup(final ServletContext context) throws ServletException { final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); root.scan("at.ac.tuwien.infosys"); context.addListener(new ContextLoaderListener(root)); final ServletRegistration.Dynamic appServlet = context.addServlet("appServlet", new DispatcherServlet(new GenericWebApplicationContext())); appServlet.setAsyncSupported(true);/*w w w.j a v a2 s . co m*/ appServlet.setLoadOnStartup(1); appServlet.addMapping("/*"); }
From source file:com.controller.config.MainWebApplicationInitizer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.scan("com.controller.config"); servletContext.addListener(new ContextLoaderListener(rootContext)); ServletRegistration.Dynamic dispather = servletContext.addServlet("CXFServlet", CXFServlet.class); dispather.addMapping("/rest/*"); }
From source file:com.graphaware.server.foundation.context.GraphAwareWebContextCreator.java
@Override protected void registerConfigClasses(AnnotationConfigWebApplicationContext context, Config config) { configureStatsCollector(context, config); context.scan(addStatsPackage(getPackagesToScan(config))); }
From source file:com.econcept.init.MainWebAppplicationInitializer.java
@Override public void onStartup(ServletContext pContainer) throws ServletException { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext lRootContext = new AnnotationConfigWebApplicationContext(); lRootContext.scan("com.econcept.init"); // Manage the lifecycle of the root application context pContainer.addListener(new ContextLoaderListener(lRootContext)); // Register and map the dispatcher servlet ServletRegistration.Dynamic lDispatcher = pContainer.addServlet("CFXServlet", CXFServlet.class); lDispatcher.addMapping("/rest/*"); // Apply Spring OAuthSecurity to both forward and request dispatcher FilterRegistration.Dynamic lFilter = pContainer.addFilter("unicodeFilter", new UnicodeFilter()); lFilter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), true, "/*"); // Apply Spring OAuthSecurity to both forward and request dispatcher lFilter = pContainer.addFilter("securityFilter", new DelegatingFilterProxy("springSecurityFilterChain")); lFilter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), true, "/*"); pContainer.addListener(AppHttpSessionListener.class); }
From source file:com.cfitzarl.cfjwed.Main.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { // Add spring security filter chain servletContext.addFilter("springSecurityFilterChain", DelegatingFilterProxy.class) .addMappingForUrlPatterns(null, false, "/*"); // Add Hibernate session binder servletContext.addFilter("jpaTransactionFilter", OpenEntityManagerInViewFilter.class) .addMappingForUrlPatterns(null, false, "/*"); // Define application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(WebApplicationMvcConfigurer.class); rootContext.scan("com.cfitzarl.cfjwed"); // Create a dispatcher servlet that loads the application context DispatcherServlet dispatcherServlet = new DispatcherServlet(); dispatcherServlet.setApplicationContext(rootContext); // Add the dispatcher servlet to the servlet context and map it to / ServletRegistration.Dynamic servletRegister = servletContext.addServlet("dispatcher", dispatcherServlet); servletRegister.setLoadOnStartup(1); servletRegister.addMapping("/"); servletContext.addListener(new ContextLoaderListener(rootContext)); }
From source file:org.shaigor.rest.retro.security.gateway.config.SecureWebAppInitializer.java
@Override protected WebApplicationContext createServletApplicationContext() { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.getEnvironment().setActiveProfiles("prod"); context.scan(ClassUtils.getPackageName(getClass())); return context; }
From source file:com.dominion.salud.nomenclator.configuration.NOMENCLATORInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.scan("com.dominion.salud.nomenclator.configuration"); ctx.setServletContext(servletContext); ctx.refresh();// ww w. j a v a 2 s . c om logger.info(" Registrando servlets de configuracion"); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dispatcher.setInitParameter("contextClass", ctx.getClass().getName()); dispatcher.setLoadOnStartup(1); logger.info(" Agregando mapping: /"); dispatcher.addMapping("/"); logger.info(" Agregando mapping: /controller/*"); dispatcher.addMapping("/controller/*"); logger.info(" Agregando mapping: /services/*"); dispatcher.addMapping("/services/*"); servletContext.addListener(new ContextLoaderListener(ctx)); logger.info(" Servlets de configuracion registrados correctamente"); // Configuracion general logger.info(" Iniciando la configuracion del modulo"); NOMENCLATORConstantes._HOME = StringUtils.endsWith(servletContext.getRealPath("/"), File.separator) ? servletContext.getRealPath("/") : servletContext.getRealPath("/") + File.separator; NOMENCLATORConstantes._TEMP = NOMENCLATORConstantes._HOME + "WEB-INF" + File.separator + "temp" + File.separator; NOMENCLATORConstantes._VERSION = ResourceBundle.getBundle("version").getString("version"); NOMENCLATORConstantes._LOGS = NOMENCLATORConstantes._HOME + "WEB-INF" + File.separator + "classes" + File.separator + "logs"; NOMENCLATORConstantes._CONTEXT_NAME = servletContext.getServletContextName(); NOMENCLATORConstantes._CONTEXT_PATH = servletContext.getContextPath(); NOMENCLATORConstantes._CONTEXT_SERVER = servletContext.getServerInfo(); NOMENCLATORConstantes._ENABLE_TECHNICAL_INFORMATION = StringUtils.isNotBlank( ResourceBundle.getBundle("application").getString("nomenclator.enable.technical.information")) ? Boolean.parseBoolean(ResourceBundle.getBundle("application") .getString("nomenclator.enable.technical.information")) : false; PropertyConfigurator.configureAndWatch("log4j"); logger.info(" Configuracion general del sistema"); logger.info(" nomenclator.home: " + NOMENCLATORConstantes._HOME); logger.info(" nomenclator.temp: " + NOMENCLATORConstantes._TEMP); logger.info(" nomenclator.version: " + NOMENCLATORConstantes._VERSION); logger.info(" nomenclator.logs: " + NOMENCLATORConstantes._LOGS); logger.info(" nomenclator.context.name: " + NOMENCLATORConstantes._CONTEXT_NAME); logger.info(" nomenclator.context.path: " + NOMENCLATORConstantes._CONTEXT_PATH); logger.info(" nomenclator.context.server: " + NOMENCLATORConstantes._CONTEXT_SERVER); logger.info(" Parametrizacion del sistema"); logger.info(" nomenclator.enable.technical.information: " + NOMENCLATORConstantes._ENABLE_TECHNICAL_INFORMATION); logger.info(" Modulo configurado correctamente"); logger.info("MODULO INICIADO CORRECTAMENTE"); }