From 2e3d13331a487005cb48a14047386e90f6f77af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Wed, 6 Dec 2023 12:10:25 +0100 Subject: [PATCH] Document `@ModelAttribute` usage with native images Closes gh-31765 --- .../controller/ann-methods/modelattrib-method-args.adoc | 5 ++++- .../mvc-controller/ann-methods/modelattrib-method-args.adoc | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/modelattrib-method-args.adoc b/framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/modelattrib-method-args.adoc index 35abbbd828..f4a27da9d8 100644 --- a/framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/modelattrib-method-args.adoc +++ b/framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/modelattrib-method-args.adoc @@ -200,4 +200,7 @@ value type as determined by {spring-framework-api}/beans/BeanUtils.html#isSimpleProperty-java.lang.Class-[BeanUtils#isSimpleProperty] _AND_ that is not resolved by any other argument resolver is treated as an `@ModelAttribute`. - +WARNING: When compiling to native images, implicit `@ModelAttribute` as described above does +not allow proper ahead-of-time inference of related data binding reflection hints. As a consequence, +it is recommended to annotate explicitly with `@ModelAttribute` method parameters for such use case +with GraalVM. diff --git a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/modelattrib-method-args.adoc b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/modelattrib-method-args.adoc index 0e15b5448c..7744077aca 100644 --- a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/modelattrib-method-args.adoc +++ b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/modelattrib-method-args.adoc @@ -244,3 +244,8 @@ TIP: Using `@ModelAttribute` is optional. By default, any parameter that is not value type as determined by {spring-framework-api}/beans/BeanUtils.html#isSimpleProperty-java.lang.Class-[BeanUtils#isSimpleProperty] _AND_ that is not resolved by any other argument resolver is treated as an `@ModelAttribute`. + +WARNING: When compiling to native images, implicit `@ModelAttribute` as described above does +not allow proper ahead-of-time inference of related data binding reflection hints. As a consequence, +it is recommended to annotate explicitly with `@ModelAttribute` method parameters for such use case +with GraalVM.