[FEATURE] Spring Security 7 migration inspections: request matchers, and() chains, requiresChannel, apply()
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reading the existing Boot 4 migration inspections, especially SpringBoot4MockBeanMigrationInspection, and the Spring4UastLocalInspectionTool pattern in modules/spring-security or spring-core. Check how inspections gate on replacement symbols and recognize unresolved legacy names. Done means migration inspections cover the four API changes, with quick-fixes that preserve HTTP methods and add the Kotlin DSL import; the .and() chain item may need separate scope.
Written by the indexing model from the issue text.
Description
Component
Inspection
Describe the problem
Spring Security 7 (shipped with Spring Boot 4) removed or deprecated several configuration APIs that most Boot 3 security configurations use. The upgrade turns into a wall of compile errors with no guided replacement, and some changes alter behaviour silently.
Verified against spring-security-web / spring-security-config 7.1.1:
AntPathRequestMatcherandMvcRequestMatcherare removed. Replacement:PathPatternRequestMatcher.withDefaults().matcher(...), with a servlet prefix set on the builder (withDefaults().basePath("/mvc")), not on the matcher.SecurityConfigurerAdapter.and()is removed, sohttp.csrf().disable().and().formLogin()chains no longer compile. Replacement: the lambda DSLhttp.csrf { it.disable() }.formLogin(withDefaults()), or the Kotlinhttp { … }DSL. The Kotlin DSL needs theorg.springframework.security.config.annotation.web.invokeimport, which the IDE does not always offer.HttpSecurity.requiresChannel(...)is deprecated. Replacement:redirectToHttps(...).apply(SecurityConfigurerAdapter)is gone in favour ofwith(configurer, customizer);apply(SecurityConfigurer)remains.
Describe the solution
A family of Spring Security 7 migration inspections, following the existing Boot 4 migration pattern (Spring4UastLocalInspectionTool, gate on the replacement symbol, e.g. PathPatternRequestMatcher):
- Unresolved/legacy
AntPathRequestMatcher/MvcRequestMatcherusage → quick-fix toPathPatternRequestMatcher.withDefaults().matcher(<pattern>), keeping the HTTP method argument. .and()chains onHttpSecurityconfigurers → quick-fix converting the chain to the lambda DSL (Java) or the Kotlinhttp { }DSL, adding theinvokeimport.requiresChannel→redirectToHttps.apply(adapter)→with(adapter, withDefaults()).
Recognise unresolved legacy symbols by written name/import, because after the upgrade the old classes no longer resolve (same approach as SpringBoot4MockBeanMigrationInspection).
Additional context
- There is no area label for
spring-security; the code would live inmodules/spring-securityorspring-core. - Item 2 is the largest and could ship separately.
- Motivated by a public Boot 3.5 → 4.0 migration report; behaviour-level changes it lists (
LoginUrlAuthenticationEntryPointrelative redirects,@WithMockUserneedingspring-boot-starter-security-test) are out of scope here.
Created automatically by github-issue-manager skill.
- Dominant language
- Kotlin
- Stars
- 163
- Forks
- 16
- Avg merge
- 5h 35m
- Merged PRs (30d)
- 183
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from explyt/spring-plugin
-
Imported configuration's @Bean methods record the configuration class instead of the return typeOpenin:spring-core
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
explyt/spring-plugin#787 ·
Maintainers usually reply within 1 day
-
in:spring-core native-link
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
explyt/spring-plugin#375 ·
Maintainers usually reply within 1 day
-
in:spring-core navigation
Difficulty 4/5 3-5 days Newbie friendliness 55/100
explyt/spring-plugin#816 · 1 comment ·
Maintainers usually reply within 1 day
-
in:spring-web inspection
Difficulty 5/5 Over a week Newbie friendliness 38/100
explyt/spring-plugin#815 ·
Maintainers usually reply within 1 day
-
in:spring-core inspection
Difficulty 5/5 Over a week Newbie friendliness 35/100
explyt/spring-plugin#813 ·
Maintainers usually reply within 1 day
All issues in explyt/spring-plugin
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
react/react-native#59693 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
pengchujin/aerial-tv#989 · 3 comments ·
Maintainers usually reply within 1 day
-
[Submission] ViaOpensubmit-adaption submit-adaption-violation
Difficulty 1/5 Under an hour Newbie friendliness 78/100
BetterAndroid/android-notification-icon-project#811 · 2 comments ·
Maintainers usually reply within 1 day