18
18
19
19
package org .springdoc .webflux .api ;
20
20
21
- import java .lang .annotation .Annotation ;
22
21
import java .lang .reflect .Method ;
23
22
import java .util .ArrayList ;
24
23
import java .util .Arrays ;
53
52
54
53
import org .springframework .beans .factory .annotation .Autowired ;
55
54
import org .springframework .beans .factory .annotation .Value ;
56
- import org .springframework .beans .factory .config .BeanDefinition ;
57
- import org .springframework .beans .factory .config .ConfigurableListableBeanFactory ;
58
55
import org .springframework .context .ApplicationContext ;
59
- import org .springframework .core .type .StandardMethodMetadata ;
60
56
import org .springframework .http .MediaType ;
61
57
import org .springframework .http .server .reactive .ServerHttpRequest ;
62
58
import org .springframework .util .CollectionUtils ;
@@ -147,7 +143,7 @@ protected void getPaths(Map<String, Object> restControllers) {
147
143
}
148
144
}
149
145
150
- ApplicationContext applicationContext = ( ApplicationContext ) requestMappingHandlerMapping .getApplicationContext ();
146
+ ApplicationContext applicationContext = requestMappingHandlerMapping .getApplicationContext ();
151
147
Map <String , RouterFunction > routerBeans = applicationContext .getBeansOfType (RouterFunction .class );
152
148
153
149
for (Map .Entry <String , RouterFunction > entry : routerBeans .entrySet ()) {
@@ -184,7 +180,7 @@ protected void getPaths(Map<String, Object> restControllers) {
184
180
catch (NoSuchMethodException e ) {
185
181
LOGGER .error (e .getMessage ());
186
182
}
187
- if (handlerMethod != null && isPackageToScan (handlerMethod .getBeanType ().getPackage ().getName ()) && isPathToMatch (routerOperation .path ()))
183
+ if (handlerMethod != null && isPackageToScan (handlerMethod .getBeanType ().getPackage ().getName ()) && isPathToMatch (routerOperation .path ()))
188
184
calculatePath (handlerMethod , routerOperation .path (), new HashSet <>(Arrays .asList (routerOperation .method ())));
189
185
}
190
186
}
@@ -199,23 +195,4 @@ protected void calculateServerUrl(ServerHttpRequest serverHttpRequest, String ap
199
195
openAPIBuilder .setServerBaseUrl (serverBaseUrl );
200
196
}
201
197
202
- public List <String > getBeansWithAnnotation (ConfigurableListableBeanFactory factory , Class <? extends Annotation > type ) {
203
-
204
- List <String > result = new ArrayList <>();
205
-
206
- for (String name : factory .getBeanDefinitionNames ()) {
207
- BeanDefinition bd = factory .getBeanDefinition (name );
208
-
209
- if (bd .getSource () instanceof StandardMethodMetadata ) {
210
- StandardMethodMetadata metadata = (StandardMethodMetadata ) bd .getSource ();
211
-
212
- Map <String , Object > attributes = metadata .getAnnotationAttributes (type .getName ());
213
- if (null == attributes ) {
214
- continue ;
215
- }
216
- }
217
- }
218
-
219
- return result ;
220
- }
221
198
}
0 commit comments