Skip to content

Fix AOT constructor generation for custom QueryEnhancerSelector - #4381

Open
ryujungkyun wants to merge 1 commit into
spring-projects:mainfrom
ryujungkyun:fix/aot-query-enhancer-selector
Open

ryujungkyun wants to merge 1 commit into
spring-projects:mainfrom
ryujungkyun:fix/aot-query-enhancer-selector

Conversation

@ryujungkyun

@ryujungkyun ryujungkyun commented Oct 8, 2026 •

Copy link
Copy Markdown

Configuring a custom QueryEnhancerSelector via @EnableJpaRepositories causes AOT repository fragment generation to fail with an IllegalArgumentException due to the invalid JavaPoet format string super(new T$(), context).

Replace T$ with $T so the generated constructor correctly instantiates the configured selector.

Add a regression test that generates, compiles, and instantiates an AOT repository fragment with a custom selector.

Validation: JpaRepositoryContributorConfigurationTests passes. The new test reproduces the format-string exception before the fix.

Before the fix: The regression test fails with an IllegalArgumentException caused by the invalid JavaPoet format string super(new T$(), context).

Pasted Graphic 7

After the fix: The regression test passes after replacing T$ with $T, confirming successful AOT fragment generation, compilation, and instantiation with a custom QueryEnhancerSelector.

✓ shouldGenerateFragmentWithCustomQueryEnhancerSelector() 4 sec 404 ms

Fixes #4382

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 8, 2026
Signed-off-by: RyuJungKyun <prank01@naver.com>
@ryujungkyun
ryujungkyun force-pushed the fix/aot-query-enhancer-selector branch from 79381e0 to 5377b7a Compare October 8, 2026 15:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AOT repository fragment generation fails with a custom QueryEnhancerSelector

2 participants