1818
1919package org .springdoc .webflux .api ;
2020
21- import java .lang .annotation .Annotation ;
2221import java .lang .reflect .Method ;
2322import java .util .ArrayList ;
2423import java .util .Arrays ;
5352
5453import org .springframework .beans .factory .annotation .Autowired ;
5554import org .springframework .beans .factory .annotation .Value ;
56- import org .springframework .beans .factory .config .BeanDefinition ;
57- import org .springframework .beans .factory .config .ConfigurableListableBeanFactory ;
5855import org .springframework .context .ApplicationContext ;
59- import org .springframework .core .type .StandardMethodMetadata ;
6056import org .springframework .http .MediaType ;
6157import org .springframework .http .server .reactive .ServerHttpRequest ;
6258import org .springframework .util .CollectionUtils ;
@@ -147,7 +143,7 @@ protected void getPaths(Map<String, Object> restControllers) {
147143 }
148144 }
149145
150- ApplicationContext applicationContext = ( ApplicationContext ) requestMappingHandlerMapping .getApplicationContext ();
146+ ApplicationContext applicationContext = requestMappingHandlerMapping .getApplicationContext ();
151147 Map <String , RouterFunction > routerBeans = applicationContext .getBeansOfType (RouterFunction .class );
152148
153149 for (Map .Entry <String , RouterFunction > entry : routerBeans .entrySet ()) {
@@ -184,7 +180,7 @@ protected void getPaths(Map<String, Object> restControllers) {
184180 catch (NoSuchMethodException e ) {
185181 LOGGER .error (e .getMessage ());
186182 }
187- if (handlerMethod != null && isPackageToScan (handlerMethod .getBeanType ().getPackage ().getName ()) && isPathToMatch (routerOperation .path ()))
183+ if (handlerMethod != null && isPackageToScan (handlerMethod .getBeanType ().getPackage ().getName ()) && isPathToMatch (routerOperation .path ()))
188184 calculatePath (handlerMethod , routerOperation .path (), new HashSet <>(Arrays .asList (routerOperation .method ())));
189185 }
190186 }
@@ -199,23 +195,4 @@ protected void calculateServerUrl(ServerHttpRequest serverHttpRequest, String ap
199195 openAPIBuilder .setServerBaseUrl (serverBaseUrl );
200196 }
201197
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- }
221198}
0 commit comments