Skip to content

Commit 456202e

Browse files
committed
remove improvement of the mapping information
1 parent 8ffb4af commit 456202e

File tree

7 files changed

+91
-425
lines changed

7 files changed

+91
-425
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlerMappingDescription.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2025 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.boot.actuate.web.mappings.reactive;
1818

19-
import java.util.List;
20-
2119
import org.springframework.web.servlet.DispatcherServlet;
2220

2321
/**
@@ -32,22 +30,12 @@ public class DispatcherHandlerMappingDescription {
3230

3331
private final String handler;
3432

35-
private final List<DispatcherHandlerMappingDescription> children;
36-
3733
private final DispatcherHandlerMappingDetails details;
3834

39-
DispatcherHandlerMappingDescription(String predicate, String handler, DispatcherHandlerMappingDetails details, List<DispatcherHandlerMappingDescription> children) {
40-
this.predicate = predicate;
41-
this.handler = handler;
42-
this.details = details;
43-
this.children = children;
44-
}
45-
4635
DispatcherHandlerMappingDescription(String predicate, String handler, DispatcherHandlerMappingDetails details) {
4736
this.predicate = predicate;
4837
this.handler = handler;
4938
this.details = details;
50-
this.children = null;
5139
}
5240

5341
public String getHandler() {
@@ -58,10 +46,6 @@ public String getPredicate() {
5846
return this.predicate;
5947
}
6048

61-
public List<DispatcherHandlerMappingDescription> getChildren() {
62-
return this.children;
63-
}
64-
6549
public DispatcherHandlerMappingDetails getDetails() {
6650
return this.details;
6751
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProvider.java

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2025 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,13 +16,16 @@
1616

1717
package org.springframework.boot.actuate.web.mappings.reactive;
1818

19+
import java.util.ArrayList;
1920
import java.util.Arrays;
2021
import java.util.HashMap;
2122
import java.util.List;
2223
import java.util.Map;
2324
import java.util.Map.Entry;
25+
import java.util.function.Function;
2426
import java.util.stream.Stream;
2527

28+
import reactor.core.publisher.Mono;
2629

2730
import org.springframework.aot.hint.BindingReflectionHintsRegistrar;
2831
import org.springframework.aot.hint.RuntimeHints;
@@ -32,10 +35,15 @@
3235
import org.springframework.boot.actuate.web.mappings.reactive.DispatcherHandlersMappingDescriptionProvider.DispatcherHandlersMappingDescriptionProviderRuntimeHints;
3336
import org.springframework.context.ApplicationContext;
3437
import org.springframework.context.annotation.ImportRuntimeHints;
38+
import org.springframework.core.io.Resource;
3539
import org.springframework.web.method.HandlerMethod;
3640
import org.springframework.web.reactive.DispatcherHandler;
3741
import org.springframework.web.reactive.HandlerMapping;
42+
import org.springframework.web.reactive.function.server.HandlerFunction;
43+
import org.springframework.web.reactive.function.server.RequestPredicate;
3844
import org.springframework.web.reactive.function.server.RouterFunction;
45+
import org.springframework.web.reactive.function.server.RouterFunctions.Visitor;
46+
import org.springframework.web.reactive.function.server.ServerRequest;
3947
import org.springframework.web.reactive.function.server.support.RouterFunctionMapping;
4048
import org.springframework.web.reactive.handler.AbstractUrlHandlerMapping;
4149
import org.springframework.web.reactive.result.method.RequestMappingInfo;
@@ -150,7 +158,41 @@ public List<DispatcherHandlerMappingDescription> describe(RouterFunctionMapping
150158
if (routerFunction != null) {
151159
routerFunction.accept(visitor);
152160
}
153-
return visitor.getDescriptions();
161+
return visitor.descriptions;
162+
}
163+
164+
}
165+
166+
private static final class MappingDescriptionVisitor implements Visitor {
167+
168+
private final List<DispatcherHandlerMappingDescription> descriptions = new ArrayList<>();
169+
170+
@Override
171+
public void startNested(RequestPredicate predicate) {
172+
}
173+
174+
@Override
175+
public void endNested(RequestPredicate predicate) {
176+
}
177+
178+
@Override
179+
public void route(RequestPredicate predicate, HandlerFunction<?> handlerFunction) {
180+
DispatcherHandlerMappingDetails details = new DispatcherHandlerMappingDetails();
181+
details.setHandlerFunction(new HandlerFunctionDescription(handlerFunction));
182+
this.descriptions.add(
183+
new DispatcherHandlerMappingDescription(predicate.toString(), handlerFunction.toString(), details));
184+
}
185+
186+
@Override
187+
public void resources(Function<ServerRequest, Mono<Resource>> lookupFunction) {
188+
}
189+
190+
@Override
191+
public void attributes(Map<String, Object> attributes) {
192+
}
193+
194+
@Override
195+
public void unknown(RouterFunction<?> routerFunction) {
154196
}
155197

156198
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/MappingDescriptionVisitor.java

Lines changed: 0 additions & 194 deletions
This file was deleted.

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletMappingDescription.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2025 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.boot.actuate.web.mappings.servlet;
1818

19-
import java.util.List;
20-
2119
import org.springframework.web.servlet.DispatcherServlet;
2220

2321
/**
@@ -32,22 +30,12 @@ public class DispatcherServletMappingDescription {
3230

3331
private final String predicate;
3432

35-
private final List<DispatcherServletMappingDescription> children;
36-
3733
private final DispatcherServletMappingDetails details;
3834

39-
public DispatcherServletMappingDescription(String predicate, String handler, DispatcherServletMappingDetails details, List<DispatcherServletMappingDescription> children) {
40-
this.handler = handler;
41-
this.predicate = predicate;
42-
this.details = details;
43-
this.children = children;
44-
}
45-
4635
DispatcherServletMappingDescription(String predicate, String handler, DispatcherServletMappingDetails details) {
4736
this.handler = handler;
4837
this.predicate = predicate;
4938
this.details = details;
50-
this.children = null;
5139
}
5240

5341
public String getHandler() {
@@ -58,10 +46,6 @@ public String getPredicate() {
5846
return this.predicate;
5947
}
6048

61-
public List<DispatcherServletMappingDescription> getChildren() {
62-
return this.children;
63-
}
64-
6549
public DispatcherServletMappingDetails getDetails() {
6650
return this.details;
6751
}

0 commit comments

Comments
 (0)