Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnnotationFormatterFactory should support @AliasFor [SPR-14844] #19410

spring-projects-issues opened this issue Oct 25, 2016 · 1 comment


Copy link

@spring-projects-issues spring-projects-issues commented Oct 25, 2016

Sebastian Davids opened SPR-14844 and commented

Pseudo code:

public @interface MyAnnotation {
   String value() default "";

   String alias() default "not aliased";
public class Bean {
   private String toBeAliased;
public class MyAnnotationFormatterFactory implements AnnotationFormatterFactory<MyAnnotation> {

  public Printer<?> getPrinter(MyAnnotation annotation, Class<?> fieldType) {
      String alias = annotation.alias();

Expectation would be alias to be "aliased" and not "not aliased".

Affects: 4.3.3

Issue Links:

  • #18054 Support @Cache* as merged composed annotations
  • #18287 Differentiate between TypeDescriptors with same annotations but different attributes
  • #19438 NoSuchMethodError when using AnnotatedElementAdapter with Java 7
  • #19496 ConversionService performance regression
  • #19626 Annotated method argument matching performance issue
  • #19493 Improve performance for conversions using a method parameter based type descriptor with annotations

Referenced from: commits 62918ca, bf9083d

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 28, 2016

Juergen Hoeller commented

Thanks for raising this! Indeed: an unfortunate limitation, originating from the legacy annotation support in TypeDescriptor. I've revised this towards our modern-day 4.3 facilities now, with formatting annotations now being equally capable (and following the same rules) as the general composable annotation model in Spring.

As a side note, there was a backwards compatibility concern with TypeDescriptor's legacy algorithm preferring inherited annotations over locally declared composed annotations. It turns out that this would only affect lookups on a Class whereas TypeDescriptor is only designed to work against fields and method parameters, so there was no reason to hold on to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants