Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.2.1 update breaks auto-configuration in native-image #38929

Closed
wisskirchenj opened this issue Dec 25, 2023 · 1 comment
Closed

3.2.1 update breaks auto-configuration in native-image #38929

wisskirchenj opened this issue Dec 25, 2023 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@wisskirchenj
Copy link

wisskirchenj commented Dec 25, 2023

Spring boot 3.2.1 apps including Web-Mvc and Spring security dependency crash in autoconfiguration after building native image with duplicate bean registration of mvcHandlerMappingIntrospector - see log excerpt below.
Used:
Java version: 17.0.9+11-LTS, vendor version: Liberica-NIK-23.0.2-1
[INFO] [creator] Graal compiler: optimization level: 2, target machine: armv8-a
[INFO] [creator] C compiler: gcc (linux, aarch64, 11.4.0)

JVM-started app with Spring Boot 3.2.1 as well as Native image (same Java, Graal, C) with Spring 3.2.0 works fine.

w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name
'mvcHandlerMappingIntrospectorRequestTransformer' defined in null: Cannot register bean definition < ..omitted..>


APPLICATION FAILED TO START


Description:
The bean 'mvcHandlerMappingIntrospectorRequestTransformer' could not be registered. A bean with that name has already been defined and overriding is disabled.

To reproduce it suffices to add Web-MVC and security starter dependency and just one get-endpoint (see example-repo https://github.com/wisskirchenj/example-native

My suspicion is a duplicate bean registration in AOT processing, as the generated source file
target/spring-aot/main/sources/org/example/ExampleApplication__BeanFactoryRegistrations.java
contains the lines:

beanFactory.registerBeanDefinition("mvcHandlerMappingIntrospector", WebMvcConfigurationSupport__BeanDefinitions.getMvcHandlerMappingIntrospectorBeanDefinition()); // l.156
beanFactory.registerBeanDefinition("mvcHandlerMappingIntrospectorRequestTransformer", HandlerMappingIntrospectorRequestTransformer__BeanDefinitions.getMvcHandlerMappingIntrospectorRequestTransformerBeanDefinition()); // l.253

and the second line is not present, when doing spring-boot:process-aot with version 3.2.0.

EDIT: I saw now, that the class HandlerMappingIntrospectorRequestTransformer has been added recently in Spring security 6.2.1.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 25, 2023
@wisskirchenj
Copy link
Author

Oops - just saw, it's a dup of issue #38910.
Sorry - I close this issue

@philwebb philwebb added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 27, 2023
@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants