Quick revision
The short answer
We start with an inventory of the 50 applications and everything they take from the shared servers: JNDI datasources, shared libraries, security realms, server-managed sessions and configuration. Each application is then converted to an executable jar with an embedded server and explicit configuration, replacing server-level features with application-level ones such as its own connection pool and Spring Security. We migrate in waves, starting with the simplest applications, run old and new paths side by side for a time, and decommission each server once it is empty.
What to remember
In this answer, we planned the move of 50 wars from shared application servers to containers. We inventoried each application's dependencies on the server, such as JNDI datasources, shared libraries and security realms; converted applications to executable jars with an embedded server and explicit configuration; replaced server features with application ones such as an application-owned connection pool and Spring Security; migrated in waves starting with simple applications; kept both paths with routing-based rollback for a while; and decommissioned each server once it was empty.
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.
We start with an inventory of the 50 applications and everything they take from the shared servers: JNDI datasources, shared libraries, security realms, server-managed sessions and configuration. Each application is then converted to an executable jar with an embedded server and explicit configuration, replacing server-level features with application-level ones such as its own connection pool and Spring Security. We migrate in waves, starting with the simplest applications, run old and new paths side by side for a time, and decommission each server once it is empty.
Why this question is asked
A fleet of wars on shared application servers is usually stable, but it is also the place where releases are slow, upgrades are blocked by the slowest application and nobody knows exactly what the servers provide. Moving to containers is less about Docker than about making each application self-contained. Interviewers ask this scenario to see whether we plan the hidden dependencies, the order and the risk, rather than only the target. In this answer, we will build the inventory, convert one application, replace the server features, plan the waves, run both paths for a while, and close the servers down.
1Inventory What the Servers Provide
The biggest risk is the things the applications get from the server without anyone remembering. So before touching code, we list for each of the 50 applications what it uses from its environment, by reading the server configuration (server.xml, context.xml, domain configuration), the applications' web.xml and code, and by talking to the teams.
| Dependency on the server | Found in | Replacement in the container |
|---|---|---|
| JNDI datasource jdbc/OrdersDB | context.xml, @Resource lookups | HikariCP via spring.datasource.* |
| Shared libs (JDBC driver, commons) | tomcat/lib | declared dependencies in the jar |
| Security realm, container login | server.xml, web.xml | Spring Security, OIDC |
| Server-managed HTTP sessions | session replication | stateless or Spring Session + Redis |
| JMS queue via JNDI | server config | client library and explicit config |
System properties, setenv.sh | server start script | environment variables |
| Files on local disk | code, logs | object storage, stdout logs |
2Convert One Application to an Executable Jar
For a Spring application, conversion is mostly mechanical. We change the packaging back to jar, make the embedded Tomcat a normal dependency instead of provided, remove the SpringBootServletInitializer if it existed (or keep it while both paths run), and make every implicit setting explicit in application properties or environment variables. Non-Boot Spring applications first need to move to Spring Boot, which is a bigger step and is a reason to place them in later waves.
We also move to versions the target supports. Applications on Spring Boot 2 and javax.servlet often move to Boot 3 at the same time, which brings the javax to jakarta rename and Java 17 or later. Combining both changes is common, but for risky applications it can be safer to containerise first on the current version and upgrade in a separate release, so each change can be rolled back on its own.
3Replace Server Features With Application Features
Each server feature from the inventory gets an application-level replacement. A JNDI datasource becomes a connection pool owned by the application, configured with properties and secrets from the environment.
Notice the last line. On a shared server, one pool of 50 connections served the application; with 6 container instances, each with its own pool, the database sees 6 times the pool size. We size pools per instance and check the database's connection limit before the cut-over.
Container-managed security becomes Spring Security, ideally against the company's identity provider. Sticky, replicated sessions become stateless tokens or Spring Session with Redis, so any instance can serve any request. Shared libraries in tomcat/lib become declared dependencies, which often exposes version conflicts the shared classpath had hidden. Files written to local disk move to object storage or a database, and logs go to stdout.
4Migrate in Waves
We sort the 50 applications by difficulty using the inventory. Wave 1 is a handful of simple applications: Spring Boot already, stateless, one datasource, few users. They prove the pipeline, the base image, logging, monitoring and the runbook, and they build the team's confidence. Later waves take applications with sessions, JMS, security realms or non-Boot code, and the last wave holds the few that need real rework or a decision to retire them.
Each wave has the same checklist: build the image with the standard pipeline, deploy to a test environment, run the application's tests plus a smoke test against real dependencies, load test the ones that matter, then switch traffic. A wave of 5 to 10 applications every two to four weeks is realistic for a small platform team working with the application teams; 50 applications then take six to nine months.
- Pick 5 to 10 applications by difficultyfrom the inventory
- Convert to jar, explicit configreplace server features
- Deploy to test, run tests and smoke tests
- Shift traffic graduallyrouting at the load balancer
- Healthy for two weeks?YesUndeploy the war from the serverNoRoute back to the server, fix
5 steps in order. Play them, or step through them one at a time.
5Keep Both Paths, Then Decommission
For each application, we keep the war on the old server while the container version takes traffic. The load balancer or gateway routes a share of requests, 10 percent and then 100 percent, to the container, so rolling back is a routing change rather than a redeploy. The application must tolerate both versions running at once, which mostly means sharing the same database schema and not relying on server-local state.
When an application has run only in containers for an agreed period, say two weeks without a rollback, we undeploy its war. When a server has no applications left, we switch it off, remove it from monitoring and configuration management, and cancel its licence if it was a commercial server. Tracking "applications migrated" and "servers remaining" on a simple dashboard keeps the programme visible, and the licence and operations savings of each empty server are a good argument for keeping it funded.
6Follow-up questions
Should we upgrade to Spring Boot 3 during the migration?
It depends on risk. Doing both at once saves a second round of testing, but the javax to jakarta change, Java 17 and library upgrades make the release larger and harder to roll back. For simple applications, combining them is fine; for critical or fragile ones, I would containerise first on the existing version and upgrade in a later release.
What if an application relies on session replication?
We make it stateless where possible, keeping state in the client or in the database, or we move sessions to Spring Session with Redis so any instance can serve any user. Sticky sessions at the load balancer can work as a temporary step, but they break on every pod restart, so they are not a target.
How do we handle applications nobody owns any more?
The inventory exposes them. Each needs an owner or a decision: migrate as is with minimal changes, replace it, or retire it. Retiring is often the cheapest option; usage logs from the server show whether anyone still calls it. An orphan should never be the reason a server stays alive indefinitely.
7Conclusion
In this answer, we planned the move of 50 wars from shared application servers to containers. We inventoried each application's dependencies on the server, such as JNDI datasources, shared libraries and security realms; converted applications to executable jars with an embedded server and explicit configuration; replaced server features with application ones such as an application-owned connection pool and Spring Security; migrated in waves starting with simple applications; kept both paths with routing-based rollback for a while; and decommissioned each server once it was empty.
Open with
I would start with an inventory, because the real risk is what the shared servers provide without anyone remembering: JNDI datasources, shared libraries in the server's lib folder, security realms and container login, session replication, JMS resources, system properties in start scripts, and files written to local disk.
Then, if they want more
For each of the fifty applications, I would list those and their replacements. Then each application becomes an executable jar with an embedded server and explicit configuration from environment variables and secrets.
Server features become application features: the JNDI datasource becomes a Hikari pool owned by the application, sized per instance because six pods with ten connections each means sixty on the database; container security becomes Spring Security; replicated sessions become stateless or Spring Session with Redis; shared libraries become declared dependencies.
I would migrate in waves, starting with five to ten simple, stateless Boot applications to prove the pipeline, base image, logging and runbooks, and leave the complex or non-Boot ones for later waves. During each migration, the war stays on the old server and the load balancer shifts traffic gradually, so rollback is a routing change.
After a quiet period, the war is undeployed, and when a server is empty, we switch it off and track servers remaining as the programme's headline number.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 17, Spring Boot 2
- 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 Boot 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 "A company still deploys 50 Spring applications as wars to shared application servers and...": https://scrivio-interview-library.netlify.app/spring-boot/packaging-and-deployment/0c8530a37d/