I'm not certain whether this problem is caused by spring or gradle or my local environment.
Summary: Webflux App runs on different server(tomcat, netty) by gradle's version
My spring webflux project has dependencies like this:
plugins {
id 'org.springframework.boot' version '2.3.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
...
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'net.rakugakibox.spring.boot:logback-access-spring-boot-starter:2.7.1'
...
}
and gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Under this dependencies and gradlew settings, spring boot run Netty server as default as I expected.
The problem occured when I changed gradle-wrapper.properties
files like this(I just updated version):
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Now my spring boot project has dependency org.springframework.boot:spring-boot-starter-tomcat:2.3.3.RELEASE
(It also has dependency on org.springframework.boot:spring-boot-starter-reactor-netty:2.3.3.RELEASE
still)
I guess org.springframework.boot:spring-boot-starter-tomcat:2.3.3.RELEASE
comes from net.rakugakibox.spring.boot:logback-access-spring-boot-starter:2.7.1
's dependency.
Now the application runs server not on Netty, but on Tomcat.
Where does the issue lies? and How can I fix this issue? Thank you.
Comment From: joleDing
您好,您发的邮件已收到,我会尽快阅读并回复!!
Comment From: JKAK47
你好,已收到你的邮件!我尽快回复。
Comment From: bclozel
The logback-access-spring-boot-starter depends on the Spring Boot web starter (with tomcat and Spring MVC) so the second behavior looks right to me.
As for why this doesn't work the same with Gradle 6.3, I think this is really a Gradle question.
You could start by requesting the dependency insights on the command line for each version and maybe looking at Gradle release notes. There's a big version gap here as well.
If you still need more help after that, please use Gradle forums or StackOverflow. Thanks!