Skip to content

Commit a942a6e

Browse files
committed
Document behavior of profiles enabled for AOT optimizations
Closes gh-32543
1 parent 9b1d5ea commit a942a6e

File tree

1 file changed

+12
-1
lines changed
  • framework-docs/modules/ROOT/pages/core

1 file changed

+12
-1
lines changed

framework-docs/modules/ROOT/pages/core/aot.adoc

+12-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Applying such optimizations early implies the following restrictions:
1515

1616
* The classpath is fixed and fully defined at build time.
1717
* The beans defined in your application cannot change at runtime, meaning:
18-
** `@Profile`, in particular profile-specific configuration needs to be chosen at build time.
18+
** `@Profile`, in particular profile-specific configuration, needs to be chosen at build time and is automatically enabled at runtime when AOT is enabled.
1919
** `Environment` properties that impact the presence of a bean (`@Conditional`) are only considered at build time.
2020
* Bean definitions with instance suppliers (lambdas or method references) cannot be transformed ahead-of-time.
2121
* Beans registered as singletons (using `registerSingleton`, typically from
@@ -224,6 +224,17 @@ There is a bean definition for `dataSourceConfiguration` and one for `dataSource
224224
When a `datasource` instance is required, a `BeanInstanceSupplier` is called.
225225
This supplier invokes the `dataSource()` method on the `dataSourceConfiguration` bean.
226226

227+
[[aot.running]]
228+
== Running with AOT optimizations
229+
230+
AOT is a mandatory step to transform a Spring application to a native executable, so it
231+
is automatically enabled when running in this mode. It is possible to use those optimizations
232+
on the JVM by setting the `spring.aot.enabled` System property to `true`.
233+
234+
NOTE: When AOT optimizations are included, some decisions that have been taken at build-time
235+
are hard-coded in the application setup. For instance, profiles that have been enabled at
236+
build-time are automatically enabled at runtime as well.
237+
227238
[[aot.bestpractices]]
228239
== Best Practices
229240

0 commit comments

Comments
 (0)