From bcbe072d96501976c8a5fbdae6919ba44f86668d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 20 Jul 2022 10:42:56 +0100 Subject: [PATCH] Fix 500 from mappings endpoint with attributed WebFlux router function Closes gh-31784 --- .../DispatcherHandlersMappingDescriptionProvider.java | 4 +--- .../boot/actuate/web/mappings/MappingsEndpointTests.java | 9 +++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProvider.java index 49ef361185..f231b6120e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -184,8 +184,6 @@ public class DispatcherHandlersMappingDescriptionProvider implements MappingDesc @Override public void attributes(Map attributes) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Auto-generated method stub"); } @Override diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/MappingsEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/MappingsEndpointTests.java index 91ff146d15..ef3349a5eb 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/MappingsEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/MappingsEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -164,7 +164,7 @@ class MappingsEndpointTests { contextMappings, "dispatcherHandlers"); assertThat(dispatcherHandlers).containsOnlyKeys("webHandler"); List handlerMappings = dispatcherHandlers.get("webHandler"); - assertThat(handlerMappings).hasSize(3); + assertThat(handlerMappings).hasSize(4); }); } @@ -211,6 +211,11 @@ class MappingsEndpointTests { } + @Bean + RouterFunction routerFunctionWithAttributes() { + return route(GET("/four"), (request) -> ServerResponse.ok().build()).withAttribute("test", "test"); + } + } @Configuration(proxyBeanMethods = false)