I went scavenging the documentation couldn't find an annotation to configure RestClient.Builder although it does autowire it...
this is what I tried
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class AuthorizationServerTest {
@Autowired
RestClient.Builder restClientBuilder;
@Test
void noAuth() {
var restClient = restClientBuilder
.messageConverters(converters -> converters.addFirst(new OAuth2AccessTokenResponseHttpMessageConverter()))
.build();
I expected it to be equivalent to
var restClient = RestClient.builder()
// .requestFactory(new HttpComponentsClientHttpRequestFactory()) not this because I'm doing this for tracing because of https://github.com/spring-projects/spring-framework/issues/32783 which might be better solved by Spring Boot
.baseUrl("http://localhost:" + this.port)
.messageConverters(converters -> converters)
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "/authorize": Target host is not specified
Running with Spring Boot v3.2.5, Spring v6.1.6
I went scavenging the documentation couldn't find an annotation to configure
RestClient.Builderalthough it does autowire it...this is what I tried
I expected it to be equivalent to
Running with Spring Boot v3.2.5, Spring v6.1.6