bomou@dialga:~/project/demo$ ./gradlew clean nativeCompile
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Configure project :
Repository https://plugins.gradle.org/m2 deleted.
> Task :processAot
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.0.6)
2023-05-05T23:27:32.109+08:00 INFO 354838 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 17.0.5 with PID 354838 (/home/bomou/project/demo/build/classes/java/main started by bomou in /home/bomou/project/demo)
2023-05-05T23:27:32.112+08:00 INFO 354838 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default"
2023-05-05T23:27:32.771+08:00 INFO 354838 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=87e24bf6-2d3a-380b-bb92-eb9b769892da
> Task :compileAotJava
Note: /home/bomou/project/demo/build/generated/aotSources/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration__BeanDefinitions.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :generateResourcesConfigFile
[native-image-plugin] Resources configuration written into /home/bomou/project/demo/build/native/generated/generateResourcesConfigFile/resource-config.json
> Task :nativeCompile
[native-image-plugin] GraalVM Toolchain detection is disabled
[native-image-plugin] GraalVM location read from environment variable: JAVA_HOME
[native-image-plugin] Native Image executable path: /home/bomou/.sdkman/candidates/java/22.3.r17-nik/lib/svm/bin/native-image
=======================================================================================================================
GraalVM Native Image: Generating 'demo' (executable)...
========================================================================================================================
Warning: Could not resolve com.sun.el.ExpressionFactoryImpl for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl.
Warning: Could not resolve groovy.grape.GrabAnnotationTransformation for reflection configuration. Reason: java.lang.ClassNotFoundException: groovy.grape.GrabAnnotationTransformation.
Warning: Could not resolve groovy.lang.Script for reflection configuration. Reason: java.lang.ClassNotFoundException: groovy.lang.Script.
Warning: Could not resolve groovy.lang.Script for reflection configuration. Reason: java.lang.ClassNotFoundException: groovy.lang.Script.
Warning: Could not resolve groovyjarjarantlr.CommonToken for reflection configuration. Reason: java.lang.ClassNotFoundException: groovyjarjarantlr.CommonToken.
Warning: Could not resolve jakarta.persistence.Persistence for reflection configuration. Reason: java.lang.ClassNotFoundException: jakarta.persistence.Persistence.
Warning: Could not resolve javafx.beans.value.ObservableValue for reflection configuration. Reason: java.lang.ClassNotFoundException: javafx.beans.value.ObservableValue.
Warning: Could not resolve javax.money.MonetaryAmount for reflection configuration. Reason: java.lang.ClassNotFoundException: javax.money.MonetaryAmount.
Warning: Could not resolve org.codehaus.groovy.antlr.GroovySourceAST for reflection configuration. Reason: java.lang.ClassNotFoundException: org.codehaus.groovy.antlr.GroovySourceAST.
Warning: Could not resolve org.codehaus.groovy.ast.builder.AstBuilderTransformation for reflection configuration. Reason: java.lang.ClassNotFoundException: org.codehaus.groovy.ast.builder.AstBuilderTransformation.
Warning: Could not resolve org.codehaus.groovy.runtime.ScriptBytecodeAdapter for reflection configuration. Reason: java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.ScriptBytecodeAdapter.
Warning: Could not resolve org.glassfish.expressly.ValueExpressionImpl for reflection configuration. Reason: java.lang.ClassNotFoundException: org.glassfish.expressly.ValueExpressionImpl.
Warning: Could not resolve org.glassfish.expressly.parser.AstValue for reflection configuration. Reason: java.lang.ClassNotFoundException: org.glassfish.expressly.parser.AstValue.
Warning: Could not resolve org.joda.time.ReadableInstant for reflection configuration. Reason: java.lang.ClassNotFoundException: org.joda.time.ReadableInstant.
Warning: Could not register method org.hibernate.validator.internal.constraintvalidators.bv.time.future.FutureValidatorForReadablePartial.<init>() for reflection. Reason: java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant.
Warning: Could not register method org.hibernate.validator.internal.constraintvalidators.bv.time.futureorpresent.FutureOrPresentValidatorForReadablePartial.<init>() for reflection. Reason: java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant.
Warning: Could not register method org.hibernate.validator.internal.constraintvalidators.bv.time.past.PastValidatorForReadablePartial.<init>() for reflection. Reason: java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant.
Warning: Could not register method org.hibernate.validator.internal.constraintvalidators.bv.time.pastorpresent.PastOrPresentValidatorForReadablePartial.<init>() for reflection. Reason: java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant.
Warning: Could not resolve org.jboss.logmanager.LogManager for reflection configuration. Reason: java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager.
Warning: Could not resolve org.apache.commons.logging.impl.Jdk14Logger for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.Jdk14Logger.
Warning: Could not resolve org.apache.commons.logging.impl.Log4JLogger for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.Log4JLogger.
Warning: Could not resolve org.apache.commons.logging.impl.LogFactoryImpl for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl.
Warning: Could not resolve org.apache.commons.logging.impl.WeakHashtable for reflection configuration. Reason: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.WeakHashtable.
Warning: Method sun.security.x509.AuthorityInfoAccessExtension.<init>() not found.
Warning: Method sun.security.x509.AuthorityKeyIdentifierExtension.<init>() not found.
Warning: Method sun.security.x509.BasicConstraintsExtension.<init>() not found.
Warning: Method sun.security.x509.CRLDistributionPointsExtension.<init>() not found.
Warning: Method sun.security.x509.CertificatePoliciesExtension.<init>() not found.
Warning: Method sun.security.x509.ExtendedKeyUsageExtension.<init>() not found.
Warning: Method sun.security.x509.PrivateKeyUsageExtension.<init>() not found.
Warning: Method sun.security.x509.SubjectKeyIdentifierExtension.<init>() not found.
[1/7] Initializing... (9.0s @ 0.31GB)
Version info: 'GraalVM 22.3.0 Java 17 CE'
Java version info: '17.0.5+8-LTS'
C compiler: gcc (linux, x86_64, 10.2.1)
Garbage collector: Serial GC
2 user-specific feature(s)
- com.oracle.svm.thirdparty.gson.GsonFeature
- org.springframework.aot.nativex.feature.PreComputeFieldFeature
Field org.apache.commons.logging.LogAdapter#log4jSpiPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#log4jSlf4jProviderPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#slf4jSpiPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#slf4jApiPresent set to true at build time
Field org.springframework.core.NativeDetector#imageCode set to true at build time
Field org.springframework.format.support.DefaultFormattingConversionService#jsr354Present set to false at build time
Field org.springframework.core.KotlinDetector#kotlinPresent set to false at build time
Field org.springframework.core.KotlinDetector#kotlinReflectPresent set to false at build time
Field org.springframework.cglib.core.AbstractClassGenerator#imageCode set to true at build time
Field org.springframework.boot.logging.log4j2.Log4J2LoggingSystem$Factory#PRESENT set to false at build time
Field org.springframework.cloud.bootstrap.TextEncryptorConfigBootstrapper#RSA_IS_PRESENT set to true at build time
Field org.springframework.web.servlet.view.InternalResourceViewResolver#jstlPresent set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#romePresent set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jaxb2Present set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jackson2Present set to true at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jackson2XmlPresent set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jackson2SmilePresent set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jackson2CborPresent set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#gsonPresent set to true at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jsonbPresent set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#kotlinSerializationCborPresent set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#kotlinSerializationJsonPresent set to false at build time
Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#kotlinSerializationProtobufPresent set to false at build time
Field org.springframework.http.converter.json.Jackson2ObjectMapperBuilder#jackson2XmlPresent set to false at build time
Field org.springframework.boot.logging.java.JavaLoggingSystem$Factory#PRESENT set to true at build time
Field org.springframework.web.client.RestTemplate#romePresent set to false at build time
Field org.springframework.web.client.RestTemplate#jaxb2Present set to false at build time
Field org.springframework.web.client.RestTemplate#jackson2Present set to true at build time
Field org.springframework.web.client.RestTemplate#jackson2XmlPresent set to false at build time
Field org.springframework.web.client.RestTemplate#jackson2SmilePresent set to false at build time
Field org.springframework.web.client.RestTemplate#jackson2CborPresent set to false at build time
Field org.springframework.web.client.RestTemplate#gsonPresent set to true at build time
Field org.springframework.web.client.RestTemplate#jsonbPresent set to false at build time
Field org.springframework.web.client.RestTemplate#kotlinSerializationCborPresent set to false at build time
Field org.springframework.web.client.RestTemplate#kotlinSerializationJsonPresent set to false at build time
Field org.springframework.web.client.RestTemplate#kotlinSerializationProtobufPresent set to false at build time
Field org.springframework.boot.logging.logback.LogbackLoggingSystem$Factory#PRESENT set to true at build time
Field org.springframework.core.ReactiveAdapterRegistry#reactorPresent set to true at build time
Field org.springframework.core.ReactiveAdapterRegistry#rxjava3Present set to false at build time
Field org.springframework.core.ReactiveAdapterRegistry#kotlinCoroutinesPresent set to false at build time
Field org.springframework.core.ReactiveAdapterRegistry#mutinyPresent set to false at build time
Field org.springframework.web.context.support.StandardServletEnvironment#jndiPresent set to true at build time
Field org.springframework.context.event.ApplicationListenerMethodAdapter#reactiveStreamsPresent set to true at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#jaxb2Present set to false at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#jackson2Present set to true at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#jackson2XmlPresent set to false at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#jackson2SmilePresent set to false at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#gsonPresent set to true at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#jsonbPresent set to false at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#kotlinSerializationCborPresent set to false at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#kotlinSerializationJsonPresent set to false at build time
Field org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter#kotlinSerializationProtobufPresent set to false at build time
Field org.springframework.web.context.support.WebApplicationContextUtils#jsfPresent set to false at build time
Field org.springframework.web.context.request.RequestContextHolder#jsfPresent set to false at build time
Field org.springframework.boot.logging.logback.LogbackLoggingSystemProperties#JBOSS_LOGGING_PRESENT set to true at build time
Field org.springframework.boot.autoconfigure.web.format.WebConversionService#JSR_354_PRESENT set to false at build time
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
Field org.springframework.web.servlet.mvc.method.annotation.ReactiveTypeHandler#isContextPropagationPresent set to false at build time
Field org.springframework.web.servlet.support.RequestContext#jstlPresent set to false at build time
[2/7] Performing analysis... [*********] (51.6s @ 1.82GB)
19,635 (92.81%) of 21,156 classes reachable
31,474 (68.30%) of 46,083 fields reachable
91,672 (61.80%) of 148,344 methods reachable
1,355 classes, 630 fields, and 6,602 methods registered for reflection
64 classes, 70 fields, and 55 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
[3/7] Building universe... (5.8s @ 1.94GB)
[4/7] Parsing methods... [***] (5.3s @ 2.44GB)
[5/7] Inlining methods... [***] (2.1s @ 2.21GB)
[6/7] Compiling methods... [******] (33.2s @ 1.72GB)
[7/7] Creating image... (5.1s @ 2.80GB)
39.41MB (48.11%) for code area: 59,834 compilation units
39.23MB (47.89%) for image heap: 445,881 objects and 269 resources
3.27MB ( 4.00%) for other data
81.92MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 packages in code area: Top 10 object types in image heap:
1.63MB sun.security.ssl 8.67MB byte[] for code metadata
1.09MB java.util 4.66MB java.lang.Class
853.77KB java.lang.invoke 4.18MB java.lang.String
717.98KB com.sun.crypto.provider 3.65MB byte[] for java.lang.String
596.88KB jdk.proxy4 3.52MB byte[] for general heap data
538.70KB org.apache.catalina.core 2.64MB byte[] for embedded resources
504.55KB org.apache.tomcat.util.net 1.65MB com.oracle.svm.core.hub.DynamicHubCompanion
489.62KB org.apache.coyote.http2 1.16MB byte[] for reflection metadata
488.91KB java.util.concurrent 805.16KB java.lang.String[]
488.77KB java.lang 691.37KB c.o.svm.core.hub.DynamicHub$ReflectionMetadata
31.68MB for 874 more packages 6.92MB for 3707 more object types
------------------------------------------------------------------------------------------------------------------------
7.6s (6.4% of total time) in 75 GCs | Peak RSS: 4.30GB | CPU load: 5.91
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
/home/bomou/project/demo/build/native/nativeCompile/demo (executable)
/home/bomou/project/demo/build/native/nativeCompile/demo.build_artifacts.txt (txt)
========================================================================================================================
Finished generating 'demo' in 1m 58s.
[native-image-plugin] Native Image written to: /home/bomou/project/demo/build/native/nativeCompile
BUILD SUCCESSFUL in 2m 11s
10 actionable tasks: 10 executed
If directly run with ./gradlew bootRun, it works.
But if with spring.cloud.consul.discovery.health-check-path specified, the problem will raise.
bomou@dialga:~/project/demo$ ./build/native/nativeCompile/demo --spring.cloud.consul.discovery.health-check-path=/actuator/health
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.0.6)
2023-05-05T23:57:05.377+08:00 INFO 355100 --- [ main] com.example.demo.DemoApplication : Starting AOT-processed DemoApplication using Java 17.0.5 with PID 355100 (/home/bomou/project/demo/build/native/nativeCompile/demo started by bomou in /home/bomou/project/demo)
2023-05-05T23:57:05.377+08:00 INFO 355100 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default"
2023-05-05T23:57:05.378+08:00 INFO 355100 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=6bb999ab-e7c4-3fbd-a0aa-954477fd726c
2023-05-05T23:57:05.389+08:00 INFO 355100 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-05-05T23:57:05.389+08:00 INFO 355100 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-05-05T23:57:05.389+08:00 INFO 355100 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.8]
2023-05-05T23:57:05.393+08:00 INFO 355100 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-05-05T23:57:05.393+08:00 INFO 355100 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 16 ms
2023-05-05T23:57:06.422+08:00 INFO 355100 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2023-05-05T23:57:06.424+08:00 WARN 355100 --- [ main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeDiscoveryClient': Unsatisfied dependency expressed through method 'compositeDiscoveryClient' parameter 0: Error creating bean with name 'consulDiscoveryClient': Unsatisfied dependency expressed through method 'consulDiscoveryClient' parameter 1: Error creating bean with name 'consulDiscoveryProperties': Runtime reflection is not supported for public void org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties.setHealthCheckPath(java.lang.String)
2023-05-05T23:57:06.424+08:00 INFO 355100 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-05-05T23:57:06.425+08:00 ERROR 355100 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeDiscoveryClient': Unsatisfied dependency expressed through method 'compositeDiscoveryClient' parameter 0: Error creating bean with name 'consulDiscoveryClient': Unsatisfied dependency expressed through method 'consulDiscoveryClient' parameter 1: Error creating bean with name 'consulDiscoveryProperties': Runtime reflection is not supported for public void org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties.setHealthCheckPath(java.lang.String)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:343) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:267) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:202) ~[na:na]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[demo:6.0.8]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) ~[demo:6.0.8]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[demo:6.0.8]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[demo:3.0.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[demo:3.0.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[demo:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[demo:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[demo:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[demo:3.0.6]
at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[demo:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'consulDiscoveryClient': Unsatisfied dependency expressed through method 'consulDiscoveryClient' parameter 1: Error creating bean with name 'consulDiscoveryProperties': Runtime reflection is not supported for public void org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties.setHealthCheckPath(java.lang.String)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:343) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:267) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:202) ~[na:na]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[demo:6.0.8]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1633) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1597) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1488) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1375) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[demo:6.0.8]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:327) ~[na:na]
... 21 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'consulDiscoveryProperties': Runtime reflection is not supported for public void org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties.setHealthCheckPath(java.lang.String)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:605) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[demo:6.0.8]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[demo:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[demo:6.0.8]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:327) ~[na:na]
... 39 common frames omitted
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Runtime reflection is not supported for public void org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties.setHealthCheckPath(java.lang.String)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89) ~[na:na]
at java.base@17.0.5/java.lang.reflect.Method.acquireMethodAccessor(Method.java:71) ~[demo:na]
at java.base@17.0.5/java.lang.reflect.Method.invoke(Method.java:566) ~[demo:na]
at org.springframework.boot.context.properties.bind.JavaBeanBinder$BeanProperty.setValue(JavaBeanBinder.java:372) ~[na:na]
at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:104) ~[na:na]
at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:86) ~[na:na]
at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:62) ~[na:na]
at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:476) ~[demo:3.0.6]
at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:590) ~[na:na]
at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:576) ~[na:na]
at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:474) ~[demo:3.0.6]
at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:414) ~[demo:3.0.6]
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:343) ~[demo:3.0.6]
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:332) ~[demo:3.0.6]
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:262) ~[demo:3.0.6]
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:249) ~[demo:3.0.6]
at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:93) ~[demo:3.0.6]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:96) ~[demo:3.0.6]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:79) ~[demo:3.0.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762) ~[demo:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[demo:6.0.8]
... 48 common frames omitted
Runtime reflection is not supported for public void org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties.setHealthCheckPath
Describe the bug
A problem about runtime reflection will raise when compiled as a native image if the
spring.cloud.consul.discovery.xxx
in property is specified.Sample
My environment:
Here's a minimized sample to reproduce. The demo.zip may also help.
Create a template project with Spring Initializr, checked with Spring Web, Consul Discovery, GraalVM Native Support
Edit the
application.yml
:Run
nativeCompile
, it seems work well(maybe):If directly run with
./gradlew bootRun
, it works.But if with
spring.cloud.consul.discovery.health-check-path
specified, the problem will raise.