java - 如何在 Spring Boot 应用程序中更改服务器?
问题描述
我的项目要求是使用除 tomcat 之外的另一台服务器?我们如何从 Spring Boot 应用程序中更改嵌入式服务器?
解决方案
您将需要更新pom.xml
,添加对spring-boot-starter-jetty
. 此外,您需要exclude
默认添加spring-boot-starter-tomcat
依赖项。
<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>
在毕业典礼上,
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")
}
推荐阅读
- node.js - stripe.customers.retreiveSource 在数据中接收空数组而不是卡对象
- docker - 使用 Docker For Windows 时如何访问通过 ClusterIP 公开的服务:
- spring-kafka - Spring Cloud 函数从 strem 创建 GlobalKTable
- c# - 如何将 html/components 传递给 blazor 模板?
- android - Android/iOS 应用程序:有没有办法存储与用户指纹相关联的唯一用户标识符?
- xml - Perl LibXML findvalues(...) 连接值
- javascript - jQuery .get() :当她不应该时,变量等于另一个变量
- angular - 我无法将我的内容类型设置为正确的格式
- react-native - react native不能动态改变Image组件源uri
- android - 如果设备上安装了应用程序,我如何对 Recyclerview 项目进行排序