9 Developing Spring microservices with Quarkus

 

This chapter covers

  • Comparing Spring and Quarkus/MicroProfile APIs
  • Replacing Quarkus/MicroProfile APIs with Spring APIs
  • How Quarkus implements Spring API compatibility

Spring is a popular Java microservices runtime with a large developer base that has invested a lot of time learning Spring APIs. By offering compatibility with commonly used Spring APIs, Quarkus enables Spring developers to leverage that investment and get started quickly. Spring developers can then benefit from Quarkus development features like live coding and production efficiencies like low memory usage and fast boot time. This chapter is intended for experienced Spring developers and will not cover Spring APIs in depth. The examples for this chapter update the examples from chapters 3 and 7 to use Spring APIs where possible. By updating existing examples, the following two concepts will become apparent:

  • Spring APIs can be used side by side with Quarkus and MicroProfile APIs.
  • Spring APIs and Quarkus/MicroProfile APIs have similar programming models.

The next section gives a more in-depth overview of the compatibility between Quarkus and Spring APIs.

9.1 Quarkus/Spring API compatibility overview

When adopting Quarkus, Spring developers can bring their existing API knowledge with them. The list of Quarkus/Spring compatibility extensions follows:

9.2 Spring dependency injection and configuration compatibility

9.2.1 Setting up the Spring Cloud Config Server

9.2.2 Using the Spring Config Server as a configuration source

9.2.3 Converting the Bank service to use Spring Configuration APIs

9.3 Quarkus/Spring Web API compatibility

9.4 Quarkus/Spring Data JPA compatibility

9.5 Deploying to Kubernetes

9.6 How Quarkus implements Spring API compatibility

9.7 Common Quarkus/Spring compatibility questions

9.8 Comparing the Spring Boot and Quarkus startup processes

Summary