Migrate existing spring app to spring-boot, manually configure spring-boot?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Migrating an existing Spring application to Spring Boot does not mean throwing away all manual configuration. Spring Boot is opinionated, but it still works well with explicit @Configuration classes, legacy beans you need to preserve, and step-by-step migration from older XML or servlet-container setups. The safest migration is usually incremental: bring in Boot's startup model and dependency management first, then simplify configuration only where it actually helps.
That approach keeps the application running while you move toward Boot conventions. It also makes it easier to spot what should remain manual, such as unusual data-source wiring, multiple contexts, or container-specific deployment behavior.
Start With Build and Entry Point Changes
The first step is usually the build file. In Maven, add Spring Boot's parent or dependency management and replace low-level Spring dependencies with Boot starters where possible.
Then add a Boot application class:
This gives you Boot's startup model without forcing you to delete all existing configuration on day one.
Keep Manual Configuration Where It Still Adds Value
Boot's auto-configuration is helpful, but it is not mandatory everywhere. You can keep manual bean definitions and import them into the Boot application.
This is useful when your old app has nonstandard wiring that would be awkward to express through properties alone. Later, if the configuration is ordinary enough, you can move it into application.yml and let Boot configure more of it automatically.
Migrate Web Configuration Carefully
Older Spring apps often use web.xml, XML application contexts, or a traditional WAR deployment to an external servlet container. Boot can support that transition instead of forcing an immediate switch to a fat JAR.
If you still need a WAR, extend SpringBootServletInitializer:
That lets the app run inside a servlet container while you modernize the rest of the codebase.
At the same time, move old XML configuration to Java config gradually. There is no prize for converting every file in one risky commit.
Let Boot Help Without Surrendering Control
A practical migration pattern is to adopt Boot's conventions where they reduce noise, then explicitly override where your app is special.
Typical examples include:
- move server port, logging, and simple data-source settings into
application.yml - keep custom
@Beanmethods for unusual integrations - exclude auto-configuration only when it actually conflicts with the app
Example property file:
If Boot starts configuring something you do not want, you can exclude it explicitly rather than abandoning Boot altogether.
Test the Migration in Thin Slices
Migration work fails when too many moving parts change at once. A safer order is:
- get the application starting under Boot
- confirm existing endpoints still work
- move one configuration area at a time
- add Boot features such as Actuator only after the baseline is stable
Tests are especially important here. If the old app had weak integration coverage, add that before making aggressive configuration changes.
Common Pitfalls
The most common mistake is trying to replace every manual configuration element with Boot properties in a single pass. That creates a migration that is hard to debug.
Another issue is mixing incompatible dependency versions by keeping old Spring artifacts alongside Boot starters. Let Boot manage the Spring version set unless you have a strong reason to override it.
A third problem is assuming Boot requires executable JAR packaging. It does not. WAR deployment is still a valid migration step when the environment requires it.
Summary
- Migrate incrementally: adopt Boot startup and dependency management first.
- Keep manual
@Configurationclasses where they still express real application-specific behavior. - Replace legacy XML and servlet setup gradually rather than in one large rewrite.
- Use properties for simple configuration, and explicit beans for unusual wiring.
- Validate the migration in small slices so regressions stay understandable.

