Skip to content

Commit be2388d

Browse files
author
bnasslahsen
committed
Initial support of Webflux with Functional Endpoints
1 parent df8c436 commit be2388d

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/annotations/RouterOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
*
6666
* @return the class of the Bean
6767
**/
68-
Class<?> beanClass() default Void.class;;
68+
Class<?> beanClass() default Void.class;
6969

7070
/**
7171
* The method of the handler Bean.

springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/OpenApiResource.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package org.springdoc.webflux.api;
2020

21-
import java.lang.annotation.Annotation;
2221
import java.lang.reflect.Method;
2322
import java.util.ArrayList;
2423
import java.util.Arrays;
@@ -53,10 +52,7 @@
5352

5453
import org.springframework.beans.factory.annotation.Autowired;
5554
import org.springframework.beans.factory.annotation.Value;
56-
import org.springframework.beans.factory.config.BeanDefinition;
57-
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
5855
import org.springframework.context.ApplicationContext;
59-
import org.springframework.core.type.StandardMethodMetadata;
6056
import org.springframework.http.MediaType;
6157
import org.springframework.http.server.reactive.ServerHttpRequest;
6258
import 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

Comments
 (0)