RandomPortTests from the smoke tests don't work in a native image. I get the following exception:
JUnit Jupiter:RandomPortTests:check(WebTestClient)
MethodSource [className = 'com.example.webflux.test.RandomPortTests', methodName = 'check', methodParameterTypes = 'org.springframework.test.web.reactive.server.WebTestClient']
=> java.lang.IllegalStateException: Failed to load ApplicationContext for [AotMergedContextConfiguration@773cfdc4 testClass = 'com.example.webflux.test.RandomPortTests', contextInitializerClass = 'com.example.webflux.test.RandomPortTests__TestContext001_ApplicationContextInitializer', original = [ReactiveWebMergedContextConfiguration@592d5f3a testClass = RandomPortTests, locations = '{}', classes = '{class com.example.webflux.WebfluxApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=0}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@9da1, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@2ff5511d, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@65883cec, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@58ecb434, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@324006ea, org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer@69e3359, org.springframework.boot.test.context.SpringBootTestAnnotation@13e80266], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]]]
org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:133)
org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:125)
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependenciesInAotMode(DependencyInjectionTestExecutionListener.java:142)
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:91)
org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43)
[...]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer$WebTestClientRegistrar': Runtime reflection is not supported for org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer$WebTestClientRegistrar()
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1306)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1198)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
[...]
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Runtime reflection is not supported for org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer$WebTestClientRegistrar()
org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
java.base@17.0.5/java.lang.reflect.Constructor.acquireConstructorAccessor(Constructor.java:68)
java.base@17.0.5/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:496)
java.base@17.0.5/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:197)
[...]
reproducer: run nativeTest in the webflux-netty smoke tests.