Description
Stéphane Nicoll opened SPR-13153 and commented
Status Quo
Commit 518c85b introduced a package tangle resulting from MethodParameter
's new dependency on AnnotationUtils
.
Analysis
MethodParameter
now uses AnnotationUtils
in order to support annotation attribute aliases via @AliasFor
. Without this functionality, many of the aliases for value
attributes cannot be supported in annotations on methods and method parameters. For example, the following (amongst others) rely on this support:
| spring-messaging
| @Header
|
| spring-messaging
| @Payload
|
| spring-messaging
| @SendToUser
|
| spring-web
| @CookieValue
|
| spring-web
| @MatrixVariable
|
| spring-web
| @RequestHeader
|
| spring-web
| @RequestParam
|
| spring-web
| @RequestPart
|
| spring-web
| @ResponseStatus
|
However, AnnotationUtils
already has a dependency on BridgeMethodResolver
which resides in the core
package alongside MethodParameter
, and this causes the package cycle.
Proposals
- Refactor
MethodParameter
to use reflection to invoke utility methods inAnnotationUtils
. - Refactor
AnnotationUtils
to use reflection to invoke utility methods inBridgeMethodResolver
. - Introduce subclass of
MethodParameter
in packageorg.springframework.core.annotation
with support for synthesizing annotations.- Proposed name:
SynthesizingMethodParameter
- Proposed name:
Affects: 4.2 RC2
Issue Links:
- Introduce aliases for 'value' annotation attributes [SPR-11393] #16020 Introduce aliases for 'value' annotation attributes
Referenced from: commits dc1f921