Quick revision
The short answer
I would first list the breaking changes, such as the removal of WebSecurityConfigurerAdapter, authorizeRequests giving way to authorizeHttpRequests, explicit saving of the SecurityContext and authorization on all dispatcher types, and then follow the migration guide's path: upgrade every service to Spring Security 5.8 and fix deprecations there. Before changing any configuration, each service gets authorization tests that pin down its current behaviour; common configuration moves into a platform starter so most services change in one place; and the rollout goes in waves, watching 401 and 403 rates after each deployment.
What to remember
In this answer, we planned a security upgrade across 80 services as a sequence of verifiable steps. We listed the breaking changes and scanned for them, upgraded first to 5.8 and fixed deprecations with the opt-in switches as the migration guide recommends, pinned every service's behaviour with authorization tests before changing anything, consolidated common configuration into a platform starter so future upgrades happen in one place, and rolled out in waves while watching 401 and 403 rates. The same playbook applies to the later move to Spring Security 7.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would first list the breaking changes, such as the removal of WebSecurityConfigurerAdapter, authorizeRequests giving way to authorizeHttpRequests, explicit saving of the SecurityContext and authorization on all dispatcher types, and then follow the migration guide's path: upgrade every service to Spring Security 5.8 and fix deprecations there. Before changing any configuration, each service gets authorization tests that pin down its current behaviour; common configuration moves into a platform starter so most services change in one place; and the rollout goes in waves, watching 401 and 403 rates after each deployment.
Why this question is asked
Upgrading security is the one upgrade where a silent behaviour change is worse than a crash. A service that fails to start is noticed in minutes; a service that now allows an endpoint it used to protect, or rejects one that partners call, may not be noticed for weeks. With 80 services, each with its own configuration, the risk is multiplied by the variety. Interviewers ask this scenario to see whether we can plan a large, risky change into small, verifiable steps. In this answer, we will list the breaking changes, look at the intermediate 5.8 step, build a safety net of authorization tests, consolidate configuration into a starter, and run the rollout in waves with clear signals.
1Listing the Breaking Changes
The first step is an inventory, because we cannot plan a migration whose size we do not know. For Spring Security 5 to 6 the main changes are well documented in the migration guide: WebSecurityConfigurerAdapter is removed, so every configuration must become a SecurityFilterChain bean; authorizeRequests is replaced by authorizeHttpRequests, with AuthorizationFilter instead of FilterSecurityInterceptor; antMatchers and mvcMatchers become requestMatchers; the SecurityContext is no longer saved automatically by default, so custom authentication code must save it explicitly; and authorization applies to all dispatcher types, which affects /error and forwards.
Then we scan the 80 services for each pattern, with a script or static analysis over the repositories, and produce a table: which services extend the adapter, which use custom filters that set the context, which use method security, which depend on removed classes. Spring Security 7 brings its own list, such as the further move to lambda-style configuration and the replacement of some deprecated matchers (check the 7 migration guide), so the same inventory approach is repeated later.
| Change in 6.x | Search the code for | Typical fix |
|---|---|---|
WebSecurityConfigurerAdapter removed | extends WebSecurityConfigurerAdapter | SecurityFilterChain @Bean |
authorizeRequests replaced | authorizeRequests( | authorizeHttpRequests(...) |
| Matcher methods renamed | antMatchers, mvcMatchers | requestMatchers |
| Context not saved automatically | SecurityContextHolder.setContext in filters | save via SecurityContextRepository |
| All dispatcher types authorized | error pages, forwards | permit /error or ERROR dispatch |
@EnableGlobalMethodSecurity replaced | @EnableGlobalMethodSecurity | @EnableMethodSecurity |
2Upgrading to 5.8 First
The Spring Security team recommends upgrading to 5.8, the last 5.x release, before moving to 6.0. Release 5.8 contains most of the new APIs alongside the old ones, marks the old ones as deprecated, and offers opt-in switches to make 5.8 behave like 6.0 for things such as the dispatcher type behaviour and context saving.
That turns one big jump into many small, separate changes. A service can switch to authorizeHttpRequests on 5.8, deploy and verify, then switch the SecurityContext saving behaviour, deploy and verify, all while still on the old major version and the old Spring Boot. When the deprecation warnings are gone and the opt-ins are on, the move to 6.0 together with Spring Boot 3 is mostly a dependency change. The same approach applies to 7: get to the last 6.x release, clear its deprecations, then move.
3Authorization Tests Before Any Configuration Change
Before touching a service's security configuration, we pin down its current behaviour in tests. For each endpoint, or at least each rule, we assert what happens without credentials, with a normal user and with an admin. These tests are written against the old version and must still pass after the change; any difference is a behaviour change we either intended or must fix.
Writing these for 80 services sounds expensive, but the platform team can generate a first version from each service's request mappings, and the teams fill in the expected statuses. They also pay for themselves long after the upgrade, as a regression net for every later change. A few tests with a real server for error responses cover the /error behaviour that MockMvc does not exercise.
4Moving Common Configuration Into a Platform Starter
Most of the 80 configurations are variations on the same few patterns: a resource server with JWT, public health endpoints, admin paths for one role, standard headers. Migrating 80 copies of that is 80 chances to get it wrong. So as part of the upgrade, the platform team builds a starter that provides the standard SecurityFilterChain, written once for 6.x, and services replace their own configuration with the starter plus small, declared customisations.
The upgrade then concentrates in one place. When Spring Security 7 arrives, most of the work is a new starter version, tested once against a shared suite, and the services that use it only bump a version number. Services with unusual configurations remain hand-migrated, and the inventory tells us how many.
5Rolling Out in Waves and Watching the Signals
We do not deploy 80 upgraded services in a week. We start with a pilot wave of a few low-risk internal services, then services with moderate traffic, and leave the most critical and externally facing ones for later waves, when the playbook is proven. Each wave goes to staging first, then production with a canary instance where possible.
After each deployment we watch two signals that directly reflect authorization behaviour: the rate of 401 and 403 responses per service and endpoint, compared with the week before. A jump in 401s means callers are suddenly rejected; a sudden drop in 403s on an admin path can mean a rule now allows too much. Dashboards and alerts on these rates, prepared before the first wave, let us roll back within minutes.
- Inventory breaking changesscan the code for each pattern
- Add authorization tests on the old versionpin current behaviour
- Upgrade to 5.8, fix deprecations, enable opt-inssmall deploys
- Move to the platform starter where possibleconfiguration in one place
- Upgrade to 6.x with Spring Boot 3tests must still pass
- Deploy in its wave, watch 401 and 403 ratescanary first
- Rates normal?YesMark migrated, next waveNoRoll back and investigate
7 steps in order. Play them, or step through them one at a time.
6Follow-up questions
How long would you plan for 80 services?
It depends on how many fit the starter. With most services on a standard pattern, a quarter is realistic: a few weeks for the inventory, tests and starter, then waves every week or two. The unusual services, with custom authentication filters or complex method security, usually take most of the effort and should be identified early.
What if a service has no tests and the team has moved on?
Those services carry the most risk, so the platform team writes their authorization tests first, using production access logs to see which endpoints are actually called and with which credentials. Logs are also a good source of expected behaviour when nobody remembers the rules.
Can we upgrade Spring Security without upgrading Spring Boot?
Not across the major version in practice: Spring Security 6 requires Spring Framework 6 and Jakarta EE namespaces, which come with Spring Boot 3. That is another reason to do all the security preparation on 5.8 and Boot 2.7, so the Boot 3 move is not also a security redesign.
7Conclusion
In this answer, we planned a security upgrade across 80 services as a sequence of verifiable steps. We listed the breaking changes and scanned for them, upgraded first to 5.8 and fixed deprecations with the opt-in switches as the migration guide recommends, pinned every service's behaviour with authorization tests before changing anything, consolidated common configuration into a platform starter so future upgrades happen in one place, and rolled out in waves while watching 401 and 403 rates. The same playbook applies to the later move to Spring Security 7.
Open with
I would start with an inventory of breaking changes from the migration guide: WebSecurityConfigurerAdapter removed, authorizeRequests replaced by authorizeHttpRequests, antMatchers becoming requestMatchers, the SecurityContext no longer saved automatically, and authorization applied to all dispatcher types, which affects error pages.
Then, if they want more
I would scan all 80 repositories for those patterns, so we know which services are simple and which are unusual. Following the guide, every service first goes to 5.8, where the new APIs exist alongside the old ones and there are opt-in switches for the 6.0 behaviour, so we can make small changes and deploy them one by one.
Before touching any configuration, each service gets authorization tests that pin its current behaviour: anonymous, user and admin access for each rule, plus a few real-server tests for error responses. Then I would move the common patterns into a platform starter with a standard filter chain, so most services change in one place now and for Spring Security 7 later.
Finally, the rollout goes in waves, starting with low-risk services, with dashboards on 401 and 403 rates per service and a quick rollback if they move unexpectedly.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Security 7, Spring Boot 3, Spring Security 5, Spring Framework 6
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Security reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "You lead the upgrade of 80 services from Spring Security 5.x to 6.x (and later 7). Each...": https://scrivio-interview-library.netlify.app/spring-boot/security-architecture/731073e823/