Partner – Orkes – NPI EA (cat=Spring)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Partner – Orkes – NPI EA (tag=Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

eBook – Guide Spring Cloud – NPI EA (cat=Spring Cloud)
announcement - icon

Let's get started with a Microservice Architecture with Spring Cloud:

>> Join Pro and download the eBook

eBook – Mockito – NPI EA (tag = Mockito)
announcement - icon

Mocking is an essential part of unit testing, and the Mockito library makes it easy to write clean and intuitive unit tests for your Java code.

Get started with mocking and improve your application tests using our Mockito guide:

Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Reactive – NPI EA (cat=Reactive)
announcement - icon

Spring 5 added support for reactive programming with the Spring WebFlux module, which has been improved upon ever since. Get started with the Reactor project basics and reactive programming in Spring Boot:

>> Join Pro and download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Jackson – NPI EA (cat=Jackson)
announcement - icon

Do JSON right with Jackson

Download the E-book

eBook – HTTP Client – NPI EA (cat=Http Client-Side)
announcement - icon

Get the most out of the Apache HTTP Client

Download the E-book

eBook – Maven – NPI EA (cat = Maven)
announcement - icon

Get Started with Apache Maven:

Download the E-book

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

eBook – RwS – NPI EA (cat=Spring MVC)
announcement - icon

Building a REST API with Spring?

Download the E-book

Course – LS – NPI EA (cat=Jackson)
announcement - icon

Get started with Spring and Spring Boot, through the Learn Spring course:

>> LEARN SPRING
Course – RWSB – NPI EA (cat=REST)
announcement - icon

Explore Spring Boot 3 and Spring 6 in-depth through building a full REST API with the framework:

>> The New “REST With Spring Boot”

Course – LSS – NPI EA (cat=Spring Security)
announcement - icon

Yes, Spring Security can be complex, from the more advanced functionality within the Core to the deep OAuth support in the framework.

I built the security material as two full courses - Core and OAuth, to get practical with these more complex scenarios. We explore when and how to use each feature and code through it on the backing project.

You can explore the course here:

>> Learn Spring Security

Partner – LambdaTest – NPI EA (cat=Testing)
announcement - icon

Browser testing is essential if you have a website or web applications that users interact with. Manual testing can be very helpful to an extent, but given the multiple browsers available, not to mention versions and operating system, testing everything manually becomes time-consuming and repetitive.

To help automate this process, Selenium is a popular choice for developers, as an open-source tool with a large and active community. What's more, we can further scale our automation testing by running on theLambdaTest cloud-based testing platform.

Read more through our step-by-step tutorial on how to set up Selenium tests with Java and run them on LambdaTest:

>> Automated Browser Testing With Selenium

Partner – Orkes – NPI EA (cat=Java)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Course – LSD – NPI EA (tag=Spring Data JPA)
announcement - icon

Spring Data JPA is a great way to handle the complexity of JPA with the powerful simplicity of Spring Boot.

Get started with Spring Data JPA through the guided reference course:

>> CHECK OUT THE COURSE

Partner – Moderne – NPI EA (cat=Spring Boot)
announcement - icon

Refactor Java code safely — and automatically — with OpenRewrite.

Refactoring big codebases by hand is slow, risky, and easy to put off. That’s where OpenRewrite comes in. The open-source framework for large-scale, automated code transformations helps teams modernize safely and consistently.

Each month, the creators and maintainers of OpenRewrite at Moderne run live, hands-on training sessions — one for newcomers and one for experienced users. You’ll see how recipes work, how to apply them across projects, and how to modernize code with confidence.

Join the next session, bring your questions, and learn how to automate the kind of work that usually eats your sprint time.

1. Overview

In this article, we’re going to take a look at how we can migrate an existing Spring Framework application to a Spring Boot application.

Spring Boot is not intended to replace Spring, but to make working with it faster and easier. As a result, most of the changes needed for migrating an application are related to configuration. For the most part, our custom controllers and other components will remain the same.

Developing with Spring Boot brings several advantages:

  • simpler dependency management
  • default auto-configuration
  • embedded web server
  • application metrics and health checks
  • advanced externalized configuration

2. Spring Boot Starters

First, we’ll need a new set of dependencies. Spring Boot provides convenient starter dependencies, which are dependency descriptors that can bring in all the necessary technology for certain functionality.

These have the advantage that you no longer need to specify a version for each dependency, but instead, let the starter manage dependencies for you.

The quickest way to get started is by adding the spring-boot-starter-parent pom.xml:

<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.6.RELEASE</version> </parent>

This will take care of dependency management.

We’ll go through some more starters in the next sections, depending on which functionality we will migrate. For reference, you can find the full list of starters here.

As a more general note, we will want to remove any explicitly defined dependency version which is also managed by Spring Boot. If not, we may encounter incompatibilities between our defined versions and those used by Boot.

3. Application Entry Point

Each application built using Spring Boot needs to define the main entry point. This is usually a Java class with the main method, annotated with @SpringBootApplication:

@SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }

The @SpringBootApplication annotation adds the following annotations:

  • @Configuration – which marks the class as a source of bean definitions
  • @EnableAutoConfiguration – which tells the framework to add beans based on the dependencies on the classpath automatically
  • @ComponentScan – which scans for other configurations and beans in the same package as the Application class or below

By default, the @SpringBootApplication annotation scans all classes in the same package or below. Therefore, a convenient package structure could look like this:

package

If your application is a non-web application which creates an ApplicationContext, this code can be removed and replaced with the @SpringBootApplication class above.

An issue we may encounter has multiple configuration classes which conflict. To avoid this, we have the possibility of filtering the classes which are scanned:

@SpringBootAppliaction @ComponentScan(excludeFilters = { @ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.baeldung.config.*")}) public class Application { //... }

4. Import Configuration and Components

Spring Boot relies heavily on annotations for configuration, but you can still import your existing configuration in both annotation and XML format.

For your existing @Configuration or component classes to be picked up, you have two options:

  • move the existing classes to a package that is the same or below the main Application class package
  • import the classes explicitly

To import the classes explicitly, you can use the @ComponentScan or @Import annotations on the main class:

@SpringBootApplication @ComponentScan(basePackages="com.baeldung.config") @Import(UserRepository.class) public class Application { //... }

The official documentation recommends using annotations over XML configuration. However, if you already have XML files you do not wish to convert to Java configuration, you can still import these using @ImportResource:

@SpringBootApplication @ImportResource("applicationContext.xml") public class Application { //... }

5. Migrate Application Resources

By default, Spring Boot looks for resource files in one of the following locations:

  • /resources
  • /public
  • /static
  • /META-INF/resources

To migrate, we can move all our resource files to one of these locations, or we can customize the resource locations by setting the spring.resources.static-locations property:

spring.resources.static-locations=classpath:/images/,classpath:/jsp/

6. Migrate Application Properties

The framework will automatically load any properties defined in files called application.properties or application.yml placed in one of these locations:

  • a /config subdirectory of the current directory
  • the current directory
  • a /config directory on the classpath
  • the classpath root

To avoid loading properties explicitly, we can move them to a file with this name in one of these locations. For example, into the /resources folder which should be present on the classpath.

We can also automatically load profile-specific properties from files called application-{profile}.properties.

Also, a large number of predefined property names are available for configuring different application behaviors.

Each Spring framework module that you use in your application will require slight modifications, mainly relating to the configuration. Let’s take a look at some of the most commonly used functionalities.

7. Migrate a Spring Web Application

7.1. Web Starter

Spring Boot provides a starter for web applications that will bring in all the necessary dependencies. This means we can remove all the web-specific dependencies from the Spring framework and replace them with spring-boot-starter-web:

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>

Since Spring Boot attempts to auto-configure an application whenever possible based on the classpath, adding this dependency will result in having the @EnableWebMvc annotation added to the main Application class, as well as setting up a DispatcherServlet bean.

If you had a WebApplicationInitializer class that sets up a DispatcherServlet, this is no longer necessary, nor is the @EnableWebMvc annotation.

We can, of course, define our beans if we want a custom behavior, and in that case, our beans will be used.

If we explicitly use the @EnableWebMvc annotation on a @Configuration class, then the MVC auto-configuration will no longer be enabled.

Adding the web starter also determines the auto-configuration of the following beans:

  • support for serving static content from a directory called /static, /public, /resources or /META-INF/resources on the classpath
  • HttpMessageConverter beans for common use cases such as JSON and XML
  • a /error mapping that handles all errors

7.2. View Technologies

As far as building web pages go, the official documentation recommends not using JSP files and using a template engine instead. Auto-configuration is included for the following template engines: Thymeleaf, Groovy, FreeMarker, Mustache. All we need to do to use one of them is add the specific starter:

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>

The template files should be placed in /resources/templates folder.

If we want to continue using JSP files, we need to configure the application so that it can resolve JSPs. For example, if our files are in /webapp/WEB-INF/views, then we need to set the following properties:

spring.mvc.view.prefix=/WEB-INF/views/ spring.mvc.view.suffix=.jsp

7.3. Embedded Web Server

Also, we can also run our application using an embedded Tomcat server, which will be auto-configured on port 8080 by adding the spring-boot-starter-tomcat dependency:

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency>

Other web servers for which Spring Boot provides auto-configuration are Jetty and Undertow.

8. Migrate a Spring Security Application

The starter for enabling Spring Security is spring-boot-starter-security:

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>

By default, this will create a user called “user” with a randomly generated password logged during startup and secure all endpoints with basic authentication. However, we usually want to add our security configuration, which is different than the default.

For this reason, we will keep our existing class annotated with @EnableWebSecurity which creates a SecurityFilterChain bean and defines a custom configuration:

@Configuration @EnableWebSecurity public class SecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // ... } }

9. Migrate a Spring Data Application

Depending on which Spring Data implementation we are using, we will need to add the corresponding starter. For example, for JPA, we can add the spring-boot-starter-data-jpa dependency:

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency>

If we want to use an in-memory database, adding the corresponding dependency enabled auto-configuration for databases of type H2, Derby, and HSQLDB.

For example, to work with an H2 in-memory database, all we need is the h2 dependency:

<dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency>

If we want to work with a different database type and configuration, such as a MySQL database, then we need the dependency as well as to define a configuration.

For this, we can either keep our DataSource bean definition or make use of pre-defined properties:

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/myDb?createDatabaseIfNotExist=true spring.datasource.username=user spring.datasource.password=pass

Spring Boot will auto-configure Hibernate as the default JPA provider, as well as a transactionManager bean.

10. Conclusion

In this article, we have shown some common scenarios encountered when migrating an existing Spring application to the newer Spring Boot framework.

Overall, your experience when migrating will, of course, be highly dependent on the application you have built.

Baeldung Pro – NPI EA (cat = Baeldung)
announcement - icon

Baeldung Pro comes with both absolutely No-Ads as well as finally with Dark Mode, for a clean learning experience:

>> Explore a clean Baeldung

Once the early-adopter seats are all used, the price will go up and stay at $33/year.

Partner – Orkes – NPI EA (cat = Spring)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Partner – Orkes – NPI EA (tag = Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

eBook – HTTP Client – NPI EA (cat=HTTP Client-Side)
announcement - icon

The Apache HTTP Client is a very robust library, suitable for both simple and advanced use cases when testing HTTP endpoints. Check out our guide covering basic request and response handling, as well as security, cookies, timeouts, and more:

>> Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

Course – LS – NPI EA (cat=REST)

announcement - icon

Get started with Spring Boot and with core Spring, through the Learn Spring course:

>> CHECK OUT THE COURSE

Partner – Moderne – NPI EA (tag=Refactoring)
announcement - icon

Modern Java teams move fast — but codebases don’t always keep up. Frameworks change, dependencies drift, and tech debt builds until it starts to drag on delivery. OpenRewrite was built to fix that: an open-source refactoring engine that automates repetitive code changes while keeping developer intent intact.

The monthly training series, led by the creators and maintainers of OpenRewrite at Moderne, walks through real-world migrations and modernization patterns. Whether you’re new to recipes or ready to write your own, you’ll learn practical ways to refactor safely and at scale.

If you’ve ever wished refactoring felt as natural — and as fast — as writing code, this is a good place to start.

eBook Jackson – NPI EA – 3 (cat = Jackson)