24
24
import java .util .List ;
25
25
import java .util .Map ;
26
26
import java .util .Map .Entry ;
27
- import java .util .Optional ;
28
27
import java .util .Set ;
29
28
30
29
import javax .annotation .PostConstruct ;
37
36
import org .springdoc .core .SwaggerUiConfigProperties ;
38
37
import org .springdoc .webmvc .api .OpenApiResource ;
39
38
39
+ import org .springframework .beans .factory .ObjectProvider ;
40
40
import org .springframework .beans .factory .annotation .Value ;
41
41
import org .springframework .http .ResponseEntity ;
42
42
import org .springframework .stereotype .Controller ;
@@ -73,27 +73,27 @@ public class SwaggerWelcomeWebMvc extends SwaggerWelcomeCommon {
73
73
/**
74
74
* The Request mapping handler mapping.
75
75
*/
76
- private final Optional <RequestMappingInfoHandlerMapping > requestMappingInfoHandlerMappingOptional ;
76
+ private final ObjectProvider <RequestMappingInfoHandlerMapping > requestMappingInfoHandlerMappingObjectProvider ;
77
77
78
78
/**
79
79
* Instantiates a new Swagger welcome.
80
80
*
81
81
* @param swaggerUiConfig the swagger ui config
82
82
* @param springDocConfigProperties the spring doc config properties
83
83
* @param swaggerUiConfigParameters the swagger ui config parameters
84
- * @param requestMappingInfoHandlerMappingOptional the request mapping info handler mapping optional
84
+ * @param requestMappingInfoHandlerMappingObjectProvider the request mapping info handler mapping object provider
85
85
*/
86
- public SwaggerWelcomeWebMvc (SwaggerUiConfigProperties swaggerUiConfig , SpringDocConfigProperties springDocConfigProperties ,SwaggerUiConfigParameters swaggerUiConfigParameters , Optional <RequestMappingInfoHandlerMapping > requestMappingInfoHandlerMappingOptional ) {
86
+ public SwaggerWelcomeWebMvc (SwaggerUiConfigProperties swaggerUiConfig , SpringDocConfigProperties springDocConfigProperties ,SwaggerUiConfigParameters swaggerUiConfigParameters , ObjectProvider <RequestMappingInfoHandlerMapping > requestMappingInfoHandlerMappingObjectProvider ) {
87
87
super (swaggerUiConfig , springDocConfigProperties , swaggerUiConfigParameters );
88
- this .requestMappingInfoHandlerMappingOptional = requestMappingInfoHandlerMappingOptional ;
88
+ this .requestMappingInfoHandlerMappingObjectProvider = requestMappingInfoHandlerMappingObjectProvider ;
89
89
}
90
90
91
91
/**
92
92
* Init.
93
93
*/
94
94
@ PostConstruct
95
95
private void init () {
96
- requestMappingInfoHandlerMappingOptional . ifPresent (requestMappingHandlerMapping -> {
96
+ requestMappingInfoHandlerMappingObjectProvider . orderedStream (). forEach (requestMappingHandlerMapping -> {
97
97
Map <RequestMappingInfo , HandlerMethod > map = requestMappingHandlerMapping .getHandlerMethods ();
98
98
List <Entry <RequestMappingInfo , HandlerMethod >> entries = new ArrayList <>(map .entrySet ());
99
99
for (Map .Entry <RequestMappingInfo , HandlerMethod > entry : entries ) {
@@ -168,4 +168,4 @@ protected String buildApiDocUrl() {
168
168
protected String buildSwaggerConfigUrl () {
169
169
return apiDocsUrl + DEFAULT_PATH_SEPARATOR + SWAGGGER_CONFIG_FILE ;
170
170
}
171
- }
171
+ }
0 commit comments