Skip to content

Add support for repeatable annotations#1670

Closed
YangSiJun528 wants to merge 28 commits into
spring-io:mainfrom
YangSiJun528:main
Closed

Add support for repeatable annotations#1670
YangSiJun528 wants to merge 28 commits into
spring-io:mainfrom
YangSiJun528:main

Conversation

@YangSiJun528

@YangSiJun528 YangSiJun528 commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Resolves issue #1624 by adding support for repeatable annotations of the same type.

Key changes:

  • Deprecates AnnotationContainer#add and replaces it with AnnotationContainer#addSingle and AnnotationContainer#customizeSingle
    • AnnotationContainer#addSingle handles adding single annotations
    • AnnotationContainer#customizeSingle handles customizing single annotations
  • Adds new AnnotationContainer#addRepeatable to support repeatable annotations
  • Fixes KotlinSourceCodeWriter#writeProperty to correctly write annotations
  • Refactors code to use the new methods instead of deprecated AnnotationContainer#add
  • Adds tests

Fixes gh-1624

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 9, 2025
@mhalbritter

Copy link
Copy Markdown
Contributor

Hello! The build is failing because of formatting violations. You can check them locally by running ./mvnw verify.

@YangSiJun528

Copy link
Copy Markdown
Contributor Author

I made the fix and confirmed it works locally.

@mhalbritter

Copy link
Copy Markdown
Contributor

Hello,

thanks for the PR! I might have missed something here, but why did you create a second implementation for the annotations? Is there a reason we couldn't add the functionality for repeated annotations into the AnnotationContainer itself?

@mhalbritter mhalbritter added the status: waiting-for-feedback We need additional information before we can continue label Jul 14, 2025
@YangSiJun528

This comment was marked as resolved.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 14, 2025
@YangSiJun528

YangSiJun528 commented Jul 15, 2025

Copy link
Copy Markdown
Contributor Author

After thinking more about your previous comment, I realized there might be a better approach that allows AnnotationContainer itself to support repeated annotations.
This way, it adds support for repeatable annotations without many code changes.

You can see it in this commit — I've confirmed that it doesn't break any existing tests:
YangSiJun528@488ce5a

Sorry if my earlier proposal ended up taking unnecessary time.

Do you think this approach would be better?
If you agree, I can update the PR with this version.

@mhalbritter

Copy link
Copy Markdown
Contributor

Yes, please update the PR. Thanks!

@YangSiJun528

Copy link
Copy Markdown
Contributor Author

I've updated the PR. @mhalbritter

@mhalbritter mhalbritter added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jul 17, 2025
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
@mhalbritter mhalbritter added type: enhancement and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Jul 22, 2025
@mhalbritter mhalbritter added this to the 0.23.0 milestone Jul 22, 2025
@mhalbritter mhalbritter self-assigned this Jul 22, 2025
mhalbritter added a commit that referenced this pull request Jul 22, 2025
See gh-1670

Signed-off-by: sijun-yang <yangsijun5528@gmail.com>

Co-authored-by: Moritz Halbritter <moritz.halbritter@broadcom.com>
@mhalbritter

Copy link
Copy Markdown
Contributor

Thanks a lot @YangSiJun528 !

philipAthanasopoulos pushed a commit to philipAthanasopoulos/initializr that referenced this pull request May 31, 2026
philipAthanasopoulos pushed a commit to philipAthanasopoulos/initializr that referenced this pull request May 31, 2026
* pr/1670:
  Upgrade to Netflix DGS 9.2.2

Closes spring-iogh-1670
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support repeated annotations in AnnotationContainer

3 participants