Skip to content

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Jun 30, 2025

We now pre-initialize ClassGeneratingPropertyAccessorFactory and ClassGeneratingEntityInstantiator infrastructure to generate bytecode for their respective classes so that we include the generated code for the target AOT package. Also, we check for presence of these types to conditionally load generated classes if these are on the classpath.

This change required a stable class name therefore, we're hashing the fully-qualified class name and have aligned the class name from _Accessor to __Accessor (two underscores instead of one, same for Instantiator).

Closes #2595

@mp911de mp911de added type: enhancement A general enhancement theme: aot An issue related to Ahead-Of-Time processing labels Jun 30, 2025
@mp911de mp911de force-pushed the main branch 2 times, most recently from 646e077 to 6ac5cf8 Compare August 18, 2025 07:12
mp911de and others added 4 commits September 4, 2025 11:18
…ityInstantiator classes.

We now pre-initialize ClassGeneratingPropertyAccessorFactory and ClassGeneratingEntityInstantiator infrastructure to generate bytecode for their respective classes so that we include the generated code for the target AOT package. Also, we check for presence of these types to conditionally load generated classes if these are on the classpath.

This change required a stable class name therefore, we're hashing the fully-qualified class name and have aligned the class name from _Accessor to __Accessor (two underscores instead of one, same for Instantiator).
Update tests and add convenience API for registering configurations required to interact with certain types.
Move off TypeReference for known and loaded classes for easier handling. Introduce configuration for enabled and include/exclude filters. Refactor configuration to functional style.

# Conflicts:
#	src/main/java/org/springframework/data/aot/AotContext.java
#	src/main/java/org/springframework/data/aot/AotMappingContext.java
#	src/main/java/org/springframework/data/aot/DefaultAotContext.java
#	src/main/java/org/springframework/data/aot/ManagedTypesBeanRegistrationAotProcessor.java
#	src/main/java/org/springframework/data/repository/config/RepositoryRegistrationAotContribution.java
#	src/main/java/org/springframework/data/repository/config/RepositoryRegistrationAotProcessor.java
#	src/test/java/org/springframework/data/aot/AotContextUnitTests.java
@christophstrobl christophstrobl force-pushed the issue/2595 branch 2 times, most recently from a313db7 to 35a0fed Compare September 4, 2025 12:32
Encapsulate config, add details about ant-path-style matching.
christophstrobl pushed a commit that referenced this pull request Sep 9, 2025
…ityInstantiator classes.

We now pre-initialize ClassGeneratingPropertyAccessorFactory and ClassGeneratingEntityInstantiator infrastructure to generate bytecode for their respective classes so that we include the generated code for the target AOT package. Also, we check for presence of these types to conditionally load generated classes if these are on the classpath.

This change required a stable class name therefore, we're hashing the fully-qualified class name and have aligned the class name from _Accessor to __Accessor (two underscores instead of one, same for Instantiator).

Closes: #2595
Original Pull Request: #3318
christophstrobl added a commit that referenced this pull request Sep 9, 2025
Update tests and add convenience API for registering configurations required to interact with certain types.

See: #2595
Original Pull Request: #3318
christophstrobl pushed a commit that referenced this pull request Sep 9, 2025
Move off TypeReference for known and loaded classes for easier handling. Introduce configuration for enabled and include/exclude filters. Refactor configuration to functional style.

Original Pull Request: #3318
christophstrobl added a commit that referenced this pull request Sep 9, 2025
And fix some minor formatting issues.

Original Pull Request: #3318
christophstrobl pushed a commit that referenced this pull request Sep 9, 2025
Encapsulate config, add details about ant-path-style matching.

Original Pull Request: #3318
@christophstrobl christophstrobl deleted the issue/2595 branch September 9, 2025 09:58
@christophstrobl christophstrobl added this to the 4.0 M6 (2025.1.0) milestone Sep 9, 2025
christophstrobl added a commit that referenced this pull request Sep 9, 2025
And fix some minor formatting issues.

Original Pull Request: #3318

move
christophstrobl pushed a commit that referenced this pull request Sep 9, 2025
Encapsulate config, add details about ant-path-style matching.

Original Pull Request: #3318
christophstrobl added a commit that referenced this pull request Sep 9, 2025
@mp911de mp911de changed the title Explore including generated PersistentPropertyAccessorFactory and EntityInstantiator classes Include generated PersistentPropertyAccessorFactory and EntityInstantiator classes during AOT processing Sep 9, 2025
mp911de added a commit that referenced this pull request Sep 9, 2025
Throw MappingException referring to the entity type for easier debugging of the property creation chain.

Add exclusion for properties starting with $$_ (synthetic Hibernate fields). Exclude java.util and javax types from AOT entity processing as well as arrays.

See #2595
Original Pull Request: #3318
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-Of-Time processing type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include generated property accessors and entity instantiator bytecode in AOT classes
2 participants