Skip to content

Commit 4453102

Browse files
Adam Ostrožlíksnicoll
authored andcommitted
Polish ExceptionHandlerMethodResolver mapping
See gh-27801
1 parent 782a94f commit 4453102

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,7 @@ protected ServletInvocableHandlerMethod getExceptionHandlerMethod(
476476
// Local exception handler methods on the controller class itself.
477477
// To be invoked through the proxy, even in case of an interface-based proxy.
478478
handlerType = handlerMethod.getBeanType();
479-
ExceptionHandlerMethodResolver resolver = this.exceptionHandlerCache.get(handlerType);
480-
if (resolver == null) {
481-
resolver = new ExceptionHandlerMethodResolver(handlerType);
482-
this.exceptionHandlerCache.put(handlerType, resolver);
483-
}
479+
ExceptionHandlerMethodResolver resolver = this.exceptionHandlerCache.computeIfAbsent(handlerType, ExceptionHandlerMethodResolver::new);
484480
Method method = resolver.resolveMethod(exception);
485481
if (method != null) {
486482
return new ServletInvocableHandlerMethod(handlerMethod.getBean(), method, this.applicationContext);

0 commit comments

Comments
 (0)