Skip to content

feat: Support @AnnotatedWith on class specified by @DecoratedWith - #3868

Merged
filiphr merged 4 commits into
mapstruct:mainfrom
tangyang9464:feature/3659
May 31, 2025
Merged

filiphr merged 4 commits into
mapstruct:mainfrom
tangyang9464:feature/3659

Conversation

@tangyang9464

Copy link
Copy Markdown
Contributor

close: #3659

Signed-off-by: TangYang <tangyang9464@163.com>

@filiphr filiphr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work with the Spring decoration? In the @Mapper we are doing some special stuff in case someone uses @AnnotateWith with @Component.

@tangyang9464
tangyang9464 marked this pull request as draft May 26, 2025 10:15
1. Added deduplication of annotations for spring decorator when using @DecoratedWith.
2. Added @DecoratedWith tests for various ComponentModel decorators

Signed-off-by: TangYang <tangyang9464@163.com>
@tangyang9464
tangyang9464 marked this pull request as ready for review May 26, 2025 16:42
@tangyang9464

Copy link
Copy Markdown
Contributor Author

How does this work with the Spring decoration? In the @Mapper we are doing some special stuff in case someone uses @AnnotateWith with @Component.

For spring, I removed duplicates of @Component and @Primary (just like @component in mapper).

For jsr330/jarkata, since they do not support combined annotations like spring, combined annotations added by users (such as contain @Named) don't work; repeated additions of @Named and @Singleton will also cause compilation errors, so I think they don't need to be processed, just add corresponding tests to ensure that the annotations added by @AnnotateWith can take effect.

Do you think there are other scenarios that need to be handled? @filiphr

@filiphr filiphr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tangyang9464. I pushed some polishing commits, I'll merge once the build passes

@filiphr
filiphr merged commit ce84c81 into mapstruct:main May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support @AnnotatedWith on decorators

2 participants