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

InjectionMetadata AOT contributions do not check for existing property value #30476

Closed
snicoll opened this issue May 11, 2023 · 2 comments
Closed
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented May 11, 2023

AOT contribution for PersistenceContext does not check for the presence of an existing property in the related bean definition. Rather than using the configured property, it will contribute some code that tries to inject the default EMF.

See also spring-projects/spring-data-jpa#2753

@snicoll snicoll added in: data Issues in data modules (jdbc, orm, oxm, tx) type: bug A general bug theme: aot An issue related to Ahead-of-time processing labels May 11, 2023
@snicoll snicoll added this to the 6.0.10 milestone May 11, 2023
@snicoll snicoll self-assigned this May 11, 2023
snicoll added a commit to snicoll/spring-framework that referenced this issue May 11, 2023
PersistenceAnnotationBeanPostProcessor checks if a property value for
the element it is about to process is set and skip it, so that the
property value is used. Previously, the AOT contribution for the same
behavior did not check if a matching property value is set and therefore
override the user-defined value.

This commit introduces an additional method that filters the injected
element list so that only the elements that should be processed are
defined.

Closes spring-projectsgh-30476
@snicoll snicoll changed the title PersistenceAnnotationBeanPostProcessor AOT contributions do not check for existing property value InjectionMetadata AOT contributions do not check for existing property value May 12, 2023
@snicoll
Copy link
Member Author

snicoll commented May 12, 2023

The same applies to autowiring (albeit being much more rare).

@rishiraj88
Copy link

Thanks, @snicoll , for your comment.

izeye added a commit to izeye/spring-framework that referenced this issue May 22, 2023
mdeinum pushed a commit to mdeinum/spring-framework that referenced this issue Jun 29, 2023
Bean post processors that use InjectionMetadata checks if a property
value for the element it is about to inject is set and skip it, so
that the property value is used. Previously, the AOT contribution for
the same behavior did not check if a matching property value is set
and therefore override the user-defined value.

This commit introduces an additional method that filters the injected
element list so that only the elements that should be processed are
defined.

Closes spring-projectsgh-30476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants