优化spring boot
Undertow是Wildfly的web服务器,性能不必多说,在嵌入微服务方面比tomcat更小。
gradle环境
configurations {
compile.exclude module: 'spring-boot-starter-tomcat'
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-undertow')
// ...
}
maven环境
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
我一台主机要放多个应用,为了节省机器内存,所以选择更节省内存的容器,