gpt4 book ai didi

maven - 在springboot中,我不能排除嵌入式tomcat

转载 作者:行者123 更新时间:2023-12-04 15:55:56 25 4
gpt4 key购买 nike

我已经排除了嵌入式依赖,但它总是以 tomcat 而不是 undertow 开头。我在这个问题上一直很疯狂。希望有人能帮助我,非常感谢。我尝试了很多方法,但都没有用。这是IDEA的原因吗?任何答案都是有帮助的。

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>

<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</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>

<!--使用undertow服务器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>



<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
...

按照启动日志。

2018-08-03 14:18:12.200  INFO 9268 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 443 (https)
2018-08-03 14:18:12.225 INFO 9268 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]

最佳答案

谢谢大家。我添加了以下代码。并且有效。

    @Bean
public UndertowServletWebServerFactory
undertowServletWebServerFactory() {
UndertowServletWebServerFactory factory = new
UndertowServletWebServerFactory();
factory.addBuilderCustomizers(builder ->
builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true) .setServerOption(UndertowOptions.HTTP2_SETTINGS_ENABLE_PUSH,true));
return factory;
}

关于maven - 在springboot中,我不能排除嵌入式tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51667818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com