Skip to content

Commit 189151f

Browse files
committed
Merge branch 'ML-Marco-performance-controller-advice'
2 parents 6bb2c8b + 520f514 commit 189151f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericResponseService.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ public class GenericResponseService implements ApplicationContextAware {
145145
private final Lock reentrantLock = new ReentrantLock();
146146

147147
/**
148-
* The Context.
148+
* The constant LOGGER.
149149
*/
150-
private ApplicationContext applicationContext;
150+
private static final Logger LOGGER = LoggerFactory.getLogger(GenericResponseService.class);
151151

152152
/**
153-
* The constant LOGGER.
153+
* A list of all beans annotated with {@code @ControllerAdvice}
154154
*/
155-
private static final Logger LOGGER = LoggerFactory.getLogger(GenericResponseService.class);
155+
private List<ControllerAdviceBean> controllerAdviceBeans;
156156

157157
/**
158158
* Instantiates a new Generic response builder.
@@ -702,8 +702,6 @@ private Map<String, ApiResponse> getGenericMapResponse(HandlerMethod handlerMeth
702702
.map(ControllerAdviceInfo::getApiResponseMap)
703703
.collect(LinkedHashMap::new, Map::putAll, Map::putAll);
704704

705-
List<ControllerAdviceBean> controllerAdviceBeans = ControllerAdviceBean.findAnnotatedBeans(applicationContext);
706-
707705
List<ControllerAdviceInfo> controllerAdviceInfosNotInThisBean = controllerAdviceInfos.stream()
708706
.filter(controllerAdviceInfo ->
709707
getControllerAdviceBean(controllerAdviceBeans, controllerAdviceInfo.getControllerAdvice())
@@ -834,6 +832,6 @@ private boolean isGlobalException(Class<?> exceptionClass) {
834832

835833
@Override
836834
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
837-
this.applicationContext = applicationContext;
835+
controllerAdviceBeans = ControllerAdviceBean.findAnnotatedBeans(applicationContext);
838836
}
839837
}

0 commit comments

Comments
 (0)