You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that AnnotatedControllerExceptionResolver is using a ConcurrentHashMap when registering beans in registerControllerAdvice. Later, when resolveException is called, the entries of this Map are iterated over but keeping no reference to the original order.
As a suggestion, there could be an extra call to OrderComparator before iterating over the controllerAdviceCache.
Hello @bclozel. Sorry for reopening but after this change I can't create multiple @ControlledAdvice classes without adding explicit @Order. Wwhen I'm trying to use ConcurrentHashMap again, it works.
Example from tests with additional advice (handler moved from controller)
Hello,
When you have many
@ControllerAdvice
classes, the@Order
given to each bean is not respected.I built a sample project demonstrating this behavior: https://github.com/yodono/spring-graphql-advice-order. Despite one of my classes having an
@Order(Ordered.HIGHEST_PRECEDENCE)
annotation, it does not run first.It seems that
AnnotatedControllerExceptionResolver
is using a ConcurrentHashMap when registering beans inregisterControllerAdvice
. Later, whenresolveException
is called, the entries of this Map are iterated over but keeping no reference to the original order.As a suggestion, there could be an extra call to OrderComparator before iterating over the
controllerAdviceCache
.The text was updated successfully, but these errors were encountered: