spring boot version: 2.5.2 java version: jdk 11
maven : only webflux
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
application.yml:
spring:
webflux:
base-path: "/test"
controller:
@RestController
@RequestMapping("/user")
public class UserController {
@PostMapping("/login")
public Mono<User> putUser() {
return Mono.just(new User());
}
}
entry:
@SpringBootApplication
@EnableWebFlux
@EnableScheduling
public class TestApplication {
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
}
test: curl ip:port/test/user/login does not work, 404 error curl ip:port/user/login works
What do I have to do to make it work? need any annotation ?
thanks
Comment From: wilkinsona
@EnableWebFlux
completely disables auto-configuration of WebFlux. This means that the spring.webflux.*
properties no longer have any effect. You should remove the annotation.