【发布时间】:2018-05-19 05:48:52
【问题描述】:
我已经创建了一个基本的 REST 控制器,它使用 netty 在 Spring-boot 2 中使用响应式 Webclient 发出请求。
@RestController
@RequestMapping("/test")
@Log4j2
public class TestController {
private WebClient client;
@PostConstruct
public void setup() {
client = WebClient.builder()
.baseUrl("http://www.google.com/")
.exchangeStrategies(ExchangeStrategies.withDefaults())
.build();
}
@GetMapping
public Mono<String> hello() throws URISyntaxException {
return client.get().retrieve().bodyToMono(String.class);
}
}
当我收到 3XX 响应代码时,我希望 Web 客户端使用响应中的位置跟踪重定向并递归调用该 URI,直到我收到非 3XX 响应。
我得到的实际结果是 3XX 响应。
【问题讨论】:
-
我在 Jira 中创建了一个问题:jira.spring.io/browse/SPR-16277
-
有解决办法吗? GA-release 上的 Spring Boot 2 似乎仍然无法遵循重定向。
-
修复 (github.com/reactor/reactor-netty/issues/235) 在 netty 0.8 中,将在 Spring 5.1 中。
-
我最好在今年晚些时候找到一些丑陋的老式编码。 5.1 还需要一段时间。
标签: spring-boot project-reactor spring-webflux reactor-netty