SpringBoot Jetty container modification

After learning the SpringBoot framework, we learned that SpringBoot is embedded with Tomcat, Jetty and Undertow containers. The default embedded container is Tomcat, which can be seen on the console when we start the SpringBoot project. Specific information is as follows:

We can remove the embedded Tomcat by modifying pom.xml and replace it with another container, such as Jetty, as follows:

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <! Tomcat --> <exclusions> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <! <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency>Copy the code

After the addition, update the POM file and compile the project. After startup, the following display indicates that the change is successful.