springspring-bootspring-security

Spring Boot 3.4.1 migration, setFilterChains in WebSecurityConfiguration required a single bean, but 2 were found


migrating to Spring Boot 3.4.1 through this error

Description:

Parameter 0 of method setFilterChains in org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration required a single bean, but 2 were found:
    - webSocketAuthorizationManagerPostProcessor: defined by method 'webSocketAuthorizationManagerPostProcessor' in class path resource [org/springframework/security/config/annotation/web/socket/WebSocketObservationConfiguration.class]
    - objectPostProcessor: defined by method 'objectPostProcessor' in class path resource [org/springframework/security/config/annotation/configuration/ObjectPostProcessorConfiguration.class]

This may be due to missing parameter name information

There is a recommendation

Ensure that your compiler is configured to use the '-parameters' flag.
You may need to update both your build tool settings as well as your IDE.
(See https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#parameter-name-retention)

I've configured ma Kotlin settings following the recommendation in the Spring Framework 6.1 migration guide

build.gradle.kts

tasks.withType<JavaCompile>() {
    options.compilerArgs.add("-parameters")
}

The error is still there

Any idea?


Solution

  • Related to SEC#16299

    In fact, this is caused by Spring. I have reported this issue