In order to allow code removal with constructs like if (NativeDetector.inNativeImage()) { ... } else { ... }, NativeDetector needs to be initialized at build time. -H:+InlineBeforeAnalysis is enabled by default as of GraalVM 21.3 so no further configuration is needed.

Since build time initialization is not necessarily something we want to expose in public APIs, embedding a spring-core/src/main/resources/META-INF/native-image/org.springframework/spring-core/native-image.properties file for that purpose is the solution chosen for now.