From 07f7435b6a4864a051a4cae07cc03abb6bcdd1bc Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 27 Oct 2023 14:39:10 +0200 Subject: [PATCH] Document native image limitation of ApplicationContextRunner Closes gh-34007 --- .../docs/asciidoc/features/developing-auto-configuration.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc index 70f020dc5a90..89452335f0cf 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc @@ -149,6 +149,8 @@ An auto-configuration can be affected by many factors: user configuration (`@Bea Concretely, each test should create a well defined `ApplicationContext` that represents a combination of those customizations. `ApplicationContextRunner` provides a great way to achieve that. +WARNING: `ApplicationContextRunner` doesn't work when running the tests in a native image. + `ApplicationContextRunner` is usually defined as a field of the test class to gather the base, common configuration. The following example makes sure that `MyServiceAutoConfiguration` is always invoked: