Skip to content

Conversation

@LumanSuen
Copy link

See gh-47255

Added org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer as an optional include to enable the loading of the following configurations.

@Configuration
public class WebSecurityCustomizersConfiguration implements WebSecurityCustomizer {
    public void customize(WebSecurity web){
        web.ignoring().requestMatchers("/favicon.ico");
    }
}

However, please note that loading of @Bean definitions is still not supported.

@Configuration
public class WebSecurityCustomizersConfiguration implements WebSecurityCustomizer {
   @Bean
    public WebSecurityCustomizer faviconSecurityCustomizer() {
        return (web) -> web.ignoring().requestMatchers("/favicon.ico");
    }
}

Because @Configuration classes are not loaded by @WebMvcTest, I also can’t directly add Configuration.class to the includes, as that would make the change too extensive.

Therefore, I added org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer in the same way as org.springframework.security.web.SecurityFilterChain.

See spring-projectsgh-47255

Signed-off-by: LumanSuen <luman.suen@outlook.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 10, 2025
@wilkinsona
Copy link
Member

Thanks for the PR, @LumanSuen, but this wasn't the right approach following the modularization in 4.0.

@wilkinsona wilkinsona closed this Nov 11, 2025
@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 11, 2025
@LumanSuen LumanSuen deleted the fix/gh-47255 branch November 11, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants