本文介绍了如何在 Spring Boot 应用程序中更改服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的项目需求是使用tomcat以外的服务器?怎么能我们从 Spring Boot 应用程序更改嵌入式服务器?
推荐答案
你需要更新pom.xml
,添加spring-boot-starter-jetty
的依赖>.此外,您需要 exclude
默认添加的 spring-boot-starter-tomcat
依赖项.
You will need to update pom.xml
, add the dependency for spring-boot-starter-jetty
. Also, you will need to exclude
default added spring-boot-starter-tomcat
dependency.
<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-jetty</artifactId>
</dependency>
在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-jetty")
}
这篇关于如何在 Spring Boot 应用程序中更改服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!