|
|
|
@ -975,9 +975,9 @@ class WebMvcAutoConfigurationTests {
|
|
|
|
|
@Test
|
|
|
|
|
void problemDetailsBacksOffWhenExceptionHandler() {
|
|
|
|
|
this.contextRunner.withPropertyValues("spring.mvc.problemdetails.enabled:true")
|
|
|
|
|
.withUserConfiguration(CustomExceptionResolverConfiguration.class)
|
|
|
|
|
.withUserConfiguration(CustomExceptionHandlerConfiguration.class)
|
|
|
|
|
.run((context) -> assertThat(context).doesNotHaveBean(ProblemDetailsExceptionHandler.class)
|
|
|
|
|
.hasSingleBean(CustomExceptionResolver.class));
|
|
|
|
|
.hasSingleBean(CustomExceptionHandler.class));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assertResourceHttpRequestHandler(AssertableWebApplicationContext context,
|
|
|
|
@ -1507,17 +1507,17 @@ class WebMvcAutoConfigurationTests {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
static class CustomExceptionResolverConfiguration {
|
|
|
|
|
static class CustomExceptionHandlerConfiguration {
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
CustomExceptionResolver customExceptionResolver() {
|
|
|
|
|
return new CustomExceptionResolver();
|
|
|
|
|
CustomExceptionHandler customExceptionHandler() {
|
|
|
|
|
return new CustomExceptionHandler();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ControllerAdvice
|
|
|
|
|
static class CustomExceptionResolver extends ResponseEntityExceptionHandler {
|
|
|
|
|
static class CustomExceptionHandler extends ResponseEntityExceptionHandler {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|