Netty Server isn't used in Spring Boot 2 with Reactive starter

二次信任 提交于 2019-12-13 03:05:45

问题


I'm developing a reactive project using Spring Boot 2 and reactive starters. My problem is that when I start the app, the Tomcat server it's started instead of Netty.

Here is my dependencies task from build.gradle file:

dependencies {
compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-webflux:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-hateoas:${springBootVersion}")
compile group: 'com.github.tomakehurst', name: 'wiremock', version: '2.15.0'
compile("ro.orange.omoney:lms-token-client:0.1.0-SNAPSHOT")
testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")

}

Can you tell me why I face this problem? Thank you!


回答1:


Your project depends on spring-boot-starter-hateoas, which depends on spring-boot-starter-web, which depends on spring-boot-starter-tomcat. The final dependency causes that Tomcat is configured to run the application.

In general, you would have to exclude spring-boot-starter-web explicitely to bypass Tomcat auto-configuration.

Though, in this particular case, I believe it won't help as spring-boot-starter-hateoas project doesn't support web on reactive stack yet (in Spring Boot 2.0.0.RELEASE).

It seems that it's either HATEOAS or reactive web at the moment.

See HATEOAS on Spring Flux/Mono response for more details.



来源:https://stackoverflow.com/questions/49607828/netty-server-isnt-used-in-spring-boot-2-with-reactive-starter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!