Search in sources :

Example 1 with AnnotationConfigWebApplicationContext

use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot-admin by codecentric.

the class SpringBootAdminClientAutoConfigurationTest method load.

private void load(String... environment) {
    AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
    applicationContext.register(ServerPropertiesAutoConfiguration.class);
    applicationContext.register(RestTemplateConfiguration.class);
    applicationContext.register(ManagementServerPropertiesAutoConfiguration.class);
    applicationContext.register(EndpointAutoConfiguration.class);
    applicationContext.register(EndpointWebMvcManagementContextConfiguration.class);
    applicationContext.register(SpringBootAdminClientAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(applicationContext, environment);
    applicationContext.refresh();
    this.context = applicationContext;
}
Also used : AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext)

Example 2 with AnnotationConfigWebApplicationContext

use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot-admin by codecentric.

the class NotifierConfigurationTest method load.

private void load(Class<?> config, String... environment) {
    context = new AnnotationConfigWebApplicationContext();
    if (config != null) {
        context.register(config);
    }
    context.register(MailSenderAutoConfiguration.class);
    context.register(NotifierConfiguration.class);
    EnvironmentTestUtils.addEnvironment(context, environment);
    context.refresh();
}
Also used : AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext)

Example 3 with AnnotationConfigWebApplicationContext

use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot-admin by codecentric.

the class DiscoveryClientConfigurationTest method load.

private void load(Class<?>... configs) {
    AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
    for (Class<?> config : configs) {
        applicationContext.register(config);
    }
    applicationContext.register(PropertyPlaceholderAutoConfiguration.class);
    applicationContext.register(RestTemplateConfiguration.class);
    applicationContext.register(ServerPropertiesAutoConfiguration.class);
    applicationContext.register(AdminServerCoreConfiguration.class);
    applicationContext.register(AdminServerWebConfiguration.class);
    applicationContext.register(DiscoveryClientConfiguration.class);
    applicationContext.refresh();
    this.context = applicationContext;
}
Also used : AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext)

Example 4 with AnnotationConfigWebApplicationContext

use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.

the class EmbeddedJarStarter method main.

public static void main(String[] args) throws Exception {
    Server server = new Server(8080);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    server.setHandler(context);
    AnnotationConfigWebApplicationContext webApplicationContext = new AnnotationConfigWebApplicationContext();
    webApplicationContext.register(SpringConfiguration.class);
    DispatcherServlet dispatcherServlet = new DispatcherServlet(webApplicationContext);
    context.addServlet(new ServletHolder(dispatcherServlet), "/*");
    server.start();
    server.join();
}
Also used : Server(org.eclipse.jetty.server.Server) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) DispatcherServlet(org.springframework.web.servlet.DispatcherServlet) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext)

Example 5 with AnnotationConfigWebApplicationContext

use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project Activiti by Activiti.

the class WebConfigurer method initSpring.

/**
   * Initializes Spring and Spring MVC.
   */
private ServletRegistration.Dynamic initSpring(ServletContext servletContext, AnnotationConfigWebApplicationContext rootContext) {
    log.debug("Configuring Spring Web application context");
    AnnotationConfigWebApplicationContext dispatcherServletConfiguration = new AnnotationConfigWebApplicationContext();
    dispatcherServletConfiguration.setParent(rootContext);
    dispatcherServletConfiguration.register(DispatcherServletConfiguration.class);
    log.debug("Registering Spring MVC Servlet");
    ServletRegistration.Dynamic dispatcherServlet = servletContext.addServlet("dispatcher", new DispatcherServlet(dispatcherServletConfiguration));
    dispatcherServlet.addMapping("/service/*");
    dispatcherServlet.setLoadOnStartup(1);
    dispatcherServlet.setAsyncSupported(true);
    return dispatcherServlet;
}
Also used : ServletRegistration(javax.servlet.ServletRegistration) DispatcherServlet(org.springframework.web.servlet.DispatcherServlet) AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext)

Aggregations

AnnotationConfigWebApplicationContext (org.springframework.web.context.support.AnnotationConfigWebApplicationContext)245 Test (org.junit.Test)116 MockServletContext (org.springframework.mock.web.MockServletContext)76 DispatcherServlet (org.springframework.web.servlet.DispatcherServlet)42 ContextLoaderListener (org.springframework.web.context.ContextLoaderListener)30 MockMvc (org.springframework.test.web.servlet.MockMvc)26 ServletRegistration (javax.servlet.ServletRegistration)25 HashMap (java.util.HashMap)24 URI (java.net.URI)23 MapPropertySource (org.springframework.core.env.MapPropertySource)23 StandardEnvironment (org.springframework.core.env.StandardEnvironment)23 MessageSerDe (com.kixeye.chassis.transport.serde.MessageSerDe)21 Test (org.junit.jupiter.api.Test)17 ProtobufMessageSerDe (com.kixeye.chassis.transport.serde.converter.ProtobufMessageSerDe)15 RestTemplate (org.springframework.web.client.RestTemplate)15 ServiceError (com.kixeye.chassis.transport.dto.ServiceError)14 JsonJacksonMessageSerDe (com.kixeye.chassis.transport.serde.converter.JsonJacksonMessageSerDe)14 XmlMessageSerDe (com.kixeye.chassis.transport.serde.converter.XmlMessageSerDe)14 YamlJacksonMessageSerDe (com.kixeye.chassis.transport.serde.converter.YamlJacksonMessageSerDe)14 SerDeHttpMessageConverter (com.kixeye.chassis.transport.http.SerDeHttpMessageConverter)13