diff --git a/docs/howto.md b/docs/howto.md index 374d586d52..06184558c1 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -175,6 +175,47 @@ are quite rich so once you have access to the of ways. Or the nuclear option is to add your own `JettyEmbeddedServletContainerFactory`. +## Use Jetty instead of Tomcat + +The Spring Boot starters ("spring-boot-starter-web" in particular) use +Tomcat as an embedded container by default. You need to exclude those +dependencies and include the Jetty ones to use that container. Spring +Boot provides Tomcat and Jetty dependencies bundled together as +separate startes to help make this process as easy as possible. + +Example in Maven: + +```xml + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-jetty + +``` + +Example in Gradle: + +```groovy +configurations { + compile.exclude module: 'spring-boot-starter-tomcat' +} + +dependencies { + compile("org.springframework.boot:spring-boot-starter-web:1.0.0.RC3") + compile("org.springframework.boot:spring-boot-starter-jetty:1.0.0.RC3") + ... +} +``` + ## Use Jetty 9 Jetty 9 works with Spring Boot, but the default is to use Jetty 8 (so