Skip to content

Introduce common AOT infrastructure. #2624

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

Closed
wants to merge 14 commits into from
Closed

Introduce common AOT infrastructure. #2624

wants to merge 14 commits into from

Conversation

christophstrobl
Copy link
Member

The commons module hosts the basic infrastructure for contributing data related bits to the AOT processing.

We introduced ManagedTypes as an abstraction that allows to define what was up till now defined via the initialEntitySet in the MappingContext.
ManagedTypes may be provided per store module as a regular bean in the application context, if not present a lazy evaluating variant will be registered, picking up types annotated with one of the store specific identifyingAnnotations within the repository base packages.
This allows store implementations to provide an AotManagedTypesPostProcessor picking up the bean to render additional configuration (reflection, proxy,...) for the domain types present.

RepositoryConfigurationExtension.getAotPostProcessor() defines the type of the AotContributingRepositoryBeanPostProcessor to be used by a store module. By default the variant provided by data commons will contribute proxy/reflection configuration for all types reachable from the repository interface. This includes the domain & id types as well as those returned by repository finder methods identifying potential projection proxies.

@christophstrobl christophstrobl linked an issue May 5, 2022 that may be closed by this pull request
@christophstrobl christophstrobl requested a review from jxblum May 5, 2022 12:25
/**
* @author Christoph Strobl
*/
public class TypeUtils {
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this class can be moved to org.springframework.data.util.

I don't see anything in this class that is specific to the native AOT processing infrastructure classes in Spring Data (i.e. org.springframework.data.aot).

return types::forEach;
}

static ManagedTypes o(Supplier<Iterable<? extends Class<?>>> dataProvider) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Misspelled. No matter, I fixed in a polish commit.

};

public TypeCollector filterFields(Predicate<Field> filter) {
this.fieldFilter = filter.and(filter);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious if you meant to prepend here? I ask because the filterTypes(:Predicate) method below "appends".


static class InspectionCache {

private final Map<String, ResolvableType> mutableCache = new LinkedHashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a WeakHashMap?

christophstrobl and others added 5 commits July 1, 2022 18:17
This commit introduces initial support for framework 6 bases ahead of time processing of data components and adds extension points for module implementations.
* Refactored logic in AOT infrastructure classes.
* Annotated AOT API with Spring's @nonnull and @nullable annotations.
* Edited Javadoc.
* Introduced PredicateUtils abstract utility class encapsulating common Predicates on types and class members.
* Added comments for review and clarification.
Should be dropped on merge!
We provide an initial set of runtime hints required to spin up data repositories on GraalVM native image.
mp911de and others added 8 commits July 1, 2022 18:18
…ections.

We now provide PropertiesBasedNamedQueriesFactoryBean to create PropertiesBasedNamedQueries directly bypassing indirections through PropertiesFactoryBean and PropertiesBasedNamedQueries.
…anDefinition(…) to allow additional bean registrations.
This avoids having to touch modules to add something like ImportRuntimeHints(AuditingHints.ReactiveAuditingRuntimeHints.class) to the enabled auditing annotations.
Simplify field and method filter creation.

Reformat aot.factories.
Enables reachability analysis. Previously, the presence checks were using method invocations and the AOT processing isn't following the methods.
Improve factory methods. Integrate auditing hints in AuditingBeanRegistrationAotProcessor. Reduce visibility, improve naming.
christophstrobl added a commit that referenced this pull request Jul 4, 2022
This commit introduces initial support for framework 6 bases ahead of time processing of data components and adds extension points for module implementations.

See: #2593
Original Pull Request: #2624
christophstrobl pushed a commit that referenced this pull request Jul 4, 2022
* Refactored logic in AOT infrastructure classes.
* Annotated AOT API with Spring's @nonnull and @nullable annotations.
* Edited Javadoc.
* Introduced PredicateUtils abstract utility class encapsulating common Predicates on types and class members.
* Added comments for review and clarification.

Original Pull Request: #2624
christophstrobl added a commit that referenced this pull request Jul 4, 2022
We provide an initial set of runtime hints required to spin up data repositories on GraalVM native image.
Additionally we skip synthetic types during type inspection.

Original Pull Request: #2624
christophstrobl pushed a commit that referenced this pull request Jul 4, 2022
…ections.

We now provide PropertiesBasedNamedQueriesFactoryBean to create PropertiesBasedNamedQueries directly bypassing indirections through PropertiesFactoryBean and PropertiesBasedNamedQueries.

Original Pull Request: #2624
christophstrobl added a commit that referenced this pull request Jul 4, 2022
christophstrobl pushed a commit that referenced this pull request Jul 4, 2022
…anDefinition(…) to allow additional bean registrations.

Original Pull Request: #2624
christophstrobl added a commit that referenced this pull request Jul 4, 2022
This avoids having to touch modules to add something like ImportRuntimeHints(AuditingHints.ReactiveAuditingRuntimeHints.class) to the enabled auditing annotations.

Original Pull Request: #2624
christophstrobl pushed a commit that referenced this pull request Jul 4, 2022
Update javadoc and reformat aot.factories.

Original Pull Request: #2624
christophstrobl pushed a commit that referenced this pull request Jul 4, 2022
Enables reachability analysis. Previously, the presence checks were using method invocations and the AOT processing isn't following the methods.

Original Pull Request: #2624
christophstrobl pushed a commit that referenced this pull request Jul 4, 2022
christophstrobl pushed a commit that referenced this pull request Jul 4, 2022
Improve factory methods. Integrate auditing hints in AuditingBeanRegistrationAotProcessor. Reduce visibility, improve naming.

Original Pull Request: #2624
@mp911de mp911de deleted the issue/2593 branch May 17, 2023 09:13
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.

Add AOT infrastructure for processing repositories.
3 participants