Search in sources :

Example 1 with ExchangeStrategies

use of org.springframework.web.reactive.function.client.ExchangeStrategies in project spring-boot by spring-projects.

the class WebMvcEndpointExposureIntegrationTests method createClient.

private WebTestClient createClient(AssertableWebApplicationContext context) {
    int port = context.getSourceApplicationContext(ServletWebServerApplicationContext.class).getWebServer().getPort();
    ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder().codecs((configurer) -> configurer.defaultCodecs().maxInMemorySize(-1)).build();
    return WebTestClient.bindToServer().baseUrl("http://localhost:" + port).exchangeStrategies(exchangeStrategies).responseTimeout(Duration.ofMinutes(5)).build();
}
Also used : InMemoryAuditEventRepository(org.springframework.boot.actuate.audit.InMemoryAuditEventRepository) AnnotationConfigServletWebServerApplicationContext(org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext) HttpServletRequest(jakarta.servlet.http.HttpServletRequest) DispatcherServletAutoConfiguration(org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ServletException(jakarta.servlet.ServletException) JacksonAutoConfiguration(org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration) ServletWebServerFactoryAutoConfiguration(org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration) Supplier(java.util.function.Supplier) ServletEndpoint(org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint) EndpointServlet(org.springframework.boot.actuate.endpoint.web.EndpointServlet) WebTestClient(org.springframework.test.web.reactive.server.WebTestClient) WebApplicationContextRunner(org.springframework.boot.test.context.runner.WebApplicationContextRunner) Duration(java.time.Duration) HealthContributorAutoConfiguration(org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration) WebEndpointAutoConfiguration(org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration) InMemoryHttpTraceRepository(org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository) GetMapping(org.springframework.web.bind.annotation.GetMapping) HttpMessageConvertersAutoConfiguration(org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration) AutoConfigurations(org.springframework.boot.autoconfigure.AutoConfigurations) ServletManagementContextAutoConfiguration(org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration) AssertableWebApplicationContext(org.springframework.boot.test.context.assertj.AssertableWebApplicationContext) HttpTraceAutoConfiguration(org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceAutoConfiguration) HttpMethod(org.springframework.http.HttpMethod) IOException(java.io.IOException) EndpointAutoConfiguration(org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration) HttpServlet(jakarta.servlet.http.HttpServlet) ManagementContextAutoConfiguration(org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration) EntityExchangeResult(org.springframework.test.web.reactive.server.EntityExchangeResult) Test(org.junit.jupiter.api.Test) RestControllerEndpoint(org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint) Configuration(org.springframework.context.annotation.Configuration) HttpStatus(org.springframework.http.HttpStatus) WebMvcAutoConfiguration(org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration) ExchangeStrategies(org.springframework.web.reactive.function.client.ExchangeStrategies) HttpServletResponse(jakarta.servlet.http.HttpServletResponse) Bean(org.springframework.context.annotation.Bean) ServletWebServerApplicationContext(org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext) ExchangeStrategies(org.springframework.web.reactive.function.client.ExchangeStrategies) ServletEndpoint(org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint) RestControllerEndpoint(org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint)

Aggregations

ServletException (jakarta.servlet.ServletException)1 HttpServlet (jakarta.servlet.http.HttpServlet)1 HttpServletRequest (jakarta.servlet.http.HttpServletRequest)1 HttpServletResponse (jakarta.servlet.http.HttpServletResponse)1 IOException (java.io.IOException)1 Duration (java.time.Duration)1 Supplier (java.util.function.Supplier)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Test (org.junit.jupiter.api.Test)1 InMemoryAuditEventRepository (org.springframework.boot.actuate.audit.InMemoryAuditEventRepository)1 EndpointAutoConfiguration (org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration)1 WebEndpointAutoConfiguration (org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration)1 HealthContributorAutoConfiguration (org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration)1 HttpTraceAutoConfiguration (org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceAutoConfiguration)1 ManagementContextAutoConfiguration (org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration)1 ServletManagementContextAutoConfiguration (org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration)1 EndpointServlet (org.springframework.boot.actuate.endpoint.web.EndpointServlet)1 RestControllerEndpoint (org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint)1 ServletEndpoint (org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint)1 InMemoryHttpTraceRepository (org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository)1