You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/aot.adoc
+89-4Lines changed: 89 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,11 @@ Classpath scanning is not possible in native image arrangements and so Spring ha
16
16
17
17
Ahead of time code generation is not limited to usage with GraalVM Native Image but also offers benefits when working with regular deployments and can help optimize startup performance on the jvm.
18
18
19
+
[NOTE]
20
+
====
21
+
With AOT optimizations some decisions (like database dialects for example) will be frozen at build time and get included as is in the application setup.
22
+
====
23
+
19
24
If Ahead of Time compilation is enabled Spring Data can (depending on the actual Module in use) contribute several components during the AOT phase of your build.
20
25
21
26
* Bytecode for generated Type/Property Accessors
@@ -32,30 +37,110 @@ However, there users may fine tune the configuration with following options.
32
37
33
38
|`spring.aot.data.accessors.include`
34
39
|Comma separated list of FQCN for which to contribute Bytecode for generated Type/Property Accessors.
35
-
Ant-style include patterns matching package names (e.g. `com.acme.**`) or type names inclusion.
40
+
Ant-style include patterns matching package names (e.g. `example.springdata.**`) or type names inclusion.
36
41
Inclusion pattern matches are evaluated before exclusions for broad exclusion and selective inclusion.
37
42
38
43
|`spring.aot.data.accessors.exclude`
39
44
|Comma separated list of FQCN for which to skip contribution of Bytecode for generated Type/Property Accessors.
40
-
Ant-style exclude patterns matching package names (e.g. `com.acme.**`) or type names exclusion.
45
+
Ant-style exclude patterns matching package names (e.g. `example.springdata.**`) or type names exclusion.
41
46
Exclusion pattern matches are evaluated after inclusions for broad exclusion and selective inclusion.
42
47
43
48
|`spring.aot.repositories.enabled`
44
49
|Boolean flag to control contribution of Source Code for Repository Interfaces
45
50
46
51
|`spring.aot.[module-name].repositories.enabled`
47
-
|Boolean flag to control contribution of Source Code for Repository Interfaces for a certain module (eg. `jdbc`, `jpa`, `mongodb`, `cassandra`)
52
+
|Boolean flag to control contribution of Source Code for Repository Interfaces for a certain module (eg. `cassandra`, `jdbc`, `jpa`, `mongodb`)
53
+
54
+
|`spring.aot.repositories.metadata.enabled`
55
+
|Boolean flag to control contribution of JSON repository metadata containing query methods and actual query strings.
56
+
Requires `spring.aot.repositories.enabled` to be enabled.
48
57
|===
49
58
50
59
[[aot.repositories]]
51
60
== Ahead of Time Repositories
52
61
62
+
[NOTE]
63
+
====
64
+
Ahead of Time repositories are only available for imperative (non reactive) repository interfaces of certain modules.
65
+
The criteria identifying eligible query methods varies between the implementing modules.
66
+
====
67
+
53
68
AOT Repositories are an extension to AOT processing by pre-generating eligible query method implementations.
54
69
Query methods are opaque to developers regarding their underlying queries being executed in a query method call.
55
70
AOT repositories contribute query method implementations based on derived, annotated, and named queries that are known at build-time.
56
71
This optimization moves query method processing from runtime to build-time, which can lead to a significant performance improvement as query methods do not need to be analyzed reflectively upon each application start.
57
72
58
-
The resulting AOT repository fragment follows the naming scheme of `<Repository FQCN>Impl_AotRepository` and is placed in the same package as the repository interface.
73
+
The resulting AOT repository fragment follows the naming scheme of `<Repository FQCN>Impl__AotRepository` and is placed in the same package as the repository interface.
74
+
75
+
[WARNING]
76
+
====
77
+
Consider AOT repository classes an internal optimization.
78
+
Do not use them directly in your code as generation and implementation details may change in future releases.
79
+
====
80
+
81
+
[[aot.repositories.json]]
82
+
=== Repository Metadata
83
+
84
+
AOT processing introspects query methods and collects metadata about repository queries.
85
+
Spring Data stores this metadata in JSON files that are named after the source repository within the same package.
86
+
Repository JSON Metadata contains details about queries and fragments.
87
+
An example for the following repository is shown below:
0 commit comments