Search code examples
javaspringspring-bootspring-native

The bean 'mvcHandlerMappingIntrospectorRequestTransformer' could not be registered. A bean with that name has already been defined and overriding i


Environment: Spring Boot 3.2.1 , JDK 21, GraalVM, Spring Native, Spring Security. Error

Microsoft Windows [Version 10.0.22631.2861]
(c) Microsoft Corporation. All rights reserved.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.1)

2024-01-09T23:07:03.438+07:00  INFO 34652 --- [      

***************************
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.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

How to fix it?


Solution

  • Happen when you using Spring Security with Spring Native. This is a know issue due to Spring Native compile ( https://github.com/spring-projects/spring-boot/issues/38910 ). Wait to Spring 3.2.2 or using snapshot for resolving problem.