spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.4k stars 40.74k forks source link

StackOverflowError on nativeCompile with boot 3.4.0 #43259

Closed bsgrd closed 6 days ago

bsgrd commented 6 days ago

I just upgraded my application to Spring Boot 3.4.0 but now I get a StackOverflowError on native build. I have tried reverting to boot 3.3.3 and then everything works fine.

Build tool: gradle Spring Boot: 3.4.0 Spring Cloud: 2024.0.0-RC1 Java: 21

2024-11-22T10:18:15.220+01:00  INFO 7972 --- [resource] [           main] [                                                 ] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
2024-11-22T10:18:15.899+01:00  INFO 7972 --- [resource] [           main] [                                                 ] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 650 ms. Found 3 JDBC repository interfaces.
2024-11-22T10:18:16.198+01:00  INFO 7972 --- [resource] [           main] [                                                 ] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2024-11-22T10:18:16.211+01:00  INFO 7972 --- [resource] [           main] [                                                 ] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2024-11-22T10:18:16.504+01:00  INFO 7972 --- [resource] [           main] [                                                 ] o.s.cloud.context.scope.GenericScope     : BeanFactory id=bfd79604-8143-317e-91f5-08f361ebcf69
2024-11-22T10:18:18.401+01:00  INFO 7972 --- [resource] [           main] [                                                 ] o.s.c.s.b.BinderChildContextInitializer  : Beginning AOT processing for binder child contexts
2024-11-22T10:18:18.424+01:00  INFO 7972 --- [resource] [           main] [                                                 ] o.s.c.s.binder.DefaultBinderFactory      : Pre-creating binder child context (AOT) for kafka
Exception in thread "main" java.lang.StackOverflowError
        at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:713)
        at java.base/java.lang.reflect.Method.invoke(Method.java:571)
        at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:281)
        at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:265)
        at org.springframework.core.SerializableTypeWrapper$MethodInvokeTypeProvider.getType(SerializableTypeWrapper.java:357)
        at org.springframework.core.SerializableTypeWrapper.forTypeProvider(SerializableTypeWrapper.java:106)
        at org.springframework.core.SerializableTypeWrapper$TypeProxyInvocationHandler.invoke(SerializableTypeWrapper.java:215)
        at org.springframework.core.$Proxy6.getActualTypeArguments(Unknown Source)
        at org.springframework.core.ResolvableType.getGenerics(ResolvableType.java:809)
        at org.springframework.core.ResolvableType.getGeneric(ResolvableType.java:762)
        at org.springframework.validation.beanvalidation.BeanValidationBeanRegistrationAotProcessor$BeanValidationDelegate.lambda$processAheadOfTime$0(BeanValidationBeanRegistrationAotProcessor.java:154)
        at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:728)
        at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:707)
        at org.springframework.validation.beanvalidation.BeanValidationBeanRegistrationAotProcessor$BeanValidationDelegate.processAheadOfTime(BeanValidationBeanRegistrationAotProcessor.java:150)
        at org.springframework.validation.beanvalidation.BeanValidationBeanRegistrationAotProcessor$BeanValidationDelegate.lambda$processAheadOfTime$0(BeanValidationBeanRegistrationAotProcessor.java:170)
        at org.spring
bclozel commented 6 days ago

Duplicates https://github.com/spring-projects/spring-framework/issues/33936 If you can provide a sample application there, this would help us work out the issue. Thanks!

bsgrd commented 6 days ago

Actually removing the dependency on "org.springdoc:springdoc-openapi-starter-webmvc-ui" fixed the problem for me.