From 5819d76d9802c320e61d752a5cb028d41c29236b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Thu, 9 Feb 2023 10:33:56 +0100 Subject: [PATCH] Document AOT limitation regarding to @Bean type Closes gh-29944 --- framework-docs/src/docs/asciidoc/core/core-aot.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/framework-docs/src/docs/asciidoc/core/core-aot.adoc b/framework-docs/src/docs/asciidoc/core/core-aot.adoc index f2a5f6a106..a7df2ada16 100644 --- a/framework-docs/src/docs/asciidoc/core/core-aot.adoc +++ b/framework-docs/src/docs/asciidoc/core/core-aot.adoc @@ -18,6 +18,7 @@ Applying such optimizations early implies the following restrictions: ** `@Profile`, in particular profile-specific configuration needs to be chosen at build time. ** Environment properties that impact the presence of a bean (`@Conditional`) are only considered at build time. * Bean definitions with instance suppliers (lambdas or method references) can't be transformed Ahead of Time (see https://github.com/spring-projects/spring-framework/issues/29555[spring-framework#29555] related issue) +* The return type of methods annotated with `@Bean` should be the most specific one in order to allow proper hint inference (typically the concrete class, not an interface). When these restrictions are in place, it becomes possible to perform ahead-of-time processing at build time and generate additional assets. A Spring AOT processed application typically generates: