You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Spring Boot 3.0.2. I have tried to compile natively with mvn -PnativeTest clean test a test that uses the class ApplicationContextRunner. Without adding any 'RuntimeHints' it returns me the following error:
Failures (1):
JUnit Jupiter:ContextRunnerTests:testContextRunner()
MethodSource [className = 'com.example.errorcontextrunner.ContextRunnerTests', methodName = 'testContextRunner', methodParameterTypes = '']
=> com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface org.springframework.context.ConfigurableApplicationContext, interface org.springframework.boot.test.context.assertj.AssertableApplicationContext] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options.
org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:171)
[email protected]/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:47)
[email protected]/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1037)
org.springframework.boot.test.context.assertj.ApplicationContextAssertProvider.get(ApplicationContextAssertProvider.java:112)
org.springframework.boot.test.context.runner.AbstractApplicationContextRunner.createAssertableContext(AbstractApplicationContextRunner.java:389)
org.springframework.boot.test.context.runner.AbstractApplicationContextRunner.consumeAssertableContext(AbstractApplicationContextRunner.java:362)
org.springframework.boot.test.context.runner.AbstractApplicationContextRunner.lambda$run$0(AbstractApplicationContextRunner.java:341)
org.springframework.boot.test.util.TestPropertyValues.lambda$applyToSystemProperties$1(TestPropertyValues.java:174)
org.springframework.boot.test.util.TestPropertyValues.applyToSystemProperties(TestPropertyValues.java:188)
[...]
Failures (1):
JUnit Jupiter:ContextRunnerTests:testContextRunner()
MethodSource [className = 'com.example.errorcontextrunner.ContextRunnerTests', methodName = 'notWeb', methodParameterTypes = '']
=> java.lang.IllegalStateException: Unable to read meta-data for class com.example.errorcontextrunner.AutoConfig
org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getAnnotationMetadata(AutoConfigurationSorter.java:237)
org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getAnnotationValue(AutoConfigurationSorter.java:219)
org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getAfter(AutoConfigurationSorter.java:198)
org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClasses.getClassesRequestedAfter(AutoConfigurationSorter.java:143)
org.springframework.boot.autoconfigure.AutoConfigurationSorter.doSortByAfterAnnotation(AutoConfigurationSorter.java:90)
[...]
Caused by: java.io.FileNotFoundException: class path resource [com/example/errorcontextrunner/AutoConfig.class] cannot be opened because it does not exist
org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:211)
org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:54)
org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:48)
org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)
[...]
Apparently there is no support for native compilation of an ApplicationContextRunner test. I have reviewed the following documentation and I have not found that it is indicated that it is not supported:
wilkinsona
changed the title
Error compiling natively a test with ApplicationContextRunner
Document that testing with ApplicationContextRunner in a native image is not supported
Jan 30, 2023
Apparently there is no support for native compilation of an ApplicationContextRunner test
That's correct. There are no hooks for performing AOT processing of the context created by the runner. We'll update the documentation to reflect this limitation.
Hello,
I am using Spring Boot 3.0.2. I have tried to compile natively with
mvn -PnativeTest clean test
a test that uses the classApplicationContextRunner
. Without adding any 'RuntimeHints' it returns me the following error:It can be replicated using the following example https://github.com/ruben-garciapariente/error-context-runner-native
If I add the "RuntimeHints" for the application configuration class it returns the following error (example at https://github.com/ruben-garciapariente/error-context-runner-native/tree/2e07cbca3b716fc871c663593b0f326b5aabdf3a):
Apparently there is no support for native compilation of an
ApplicationContextRunner
test. I have reviewed the following documentation and I have not found that it is indicated that it is not supported:Thank you very much
The text was updated successfully, but these errors were encountered: