Skip to content

Package tangle in org.springframework.core [SPR-13153] #17744

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

  1. Refactor MethodParameter to use reflection to invoke utility methods in AnnotationUtils.
  2. Refactor AnnotationUtils to use reflection to invoke utility methods in BridgeMethodResolver.
  3. Introduce subclass of MethodParameter in package org.springframework.core.annotation with support for synthesizing annotations.
    • Proposed name: SynthesizingMethodParameter

Affects: 4.2 RC2

Issue Links:

Referenced from: commits dc1f921

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions