我怎么能得到
ServerWebExchange
或反应性
ServerHttpResponse
在控制器方法中?
我不断地
NestedServletException
尝试调用接受
服务器WebExchange
.
我的控制器如下:
@RestController
@RequestMapping(path = "/path/{param1}/path", produces = MediaType.APPLICATION_JSON_VALUE)
public class MyController {
@GetMapping("/path")
public Mono<Void> method(ServerWebExchange exchange) {
...
}
}
主要方法:
@SpringBootApplication
@ComponentScan(basePackages = {"my.package1", "my.package2"})
@EnableWebFlux
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
}
例外情况:
io.undertow.request:ut005023:异常处理请求到/path/value/path/path
org.springframework.web.util.nestedServletException:请求处理失败;嵌套异常为java.lang.illegalStateException:找不到接口org.springframework.web.server.serverWebExchange的主或默认构造函数