Add ServletRegistrationBean for DispatcherServlet

Mapping is exposed via server.servletPath.

Fixes gh-379
This commit is contained in:
Dave Syer
2014-02-20 09:48:51 +00:00
parent 44b877cd7d
commit b2b487ee5f
7 changed files with 147 additions and 84 deletions

View File

@@ -30,6 +30,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
@@ -43,7 +44,6 @@ import org.springframework.web.client.RestTemplate;
import sample.tomcat.service.HelloWorldService;
import sample.tomcat.web.SampleController;
import static org.junit.Assert.assertEquals;
/**
@@ -57,7 +57,8 @@ public class NonAutoConfigurationSampleTomcatApplicationTests {
@Configuration
@Import({ EmbeddedServletContainerAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
DispatcherServletAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class, WebMvcAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class })
@ComponentScan(basePackageClasses = { SampleController.class, HelloWorldService.class })