Run Your Spring Boot 3 App on Azure Spring Apps
Published Sep 11 2023 06:17 AM 2,602 Views
Microsoft

The recent release of Spring Boot 3 and Azure's dedicated service for Spring applications, Azure Spring Apps, has opened up for developers to deploy and manage their Spring Boot applications. In this blog, we'll dive deep into the new features of Spring Boot 3, introduce Azure Spring Apps, and guide you on deploying your Spring Boot 3 application on Azure Spring Apps.

Run a Spring Boot 3 App.jpg

 

1. What's New in Spring Boot 3

Spring Boot 3 and Spring 6 release has brought many new features and enhancements to the table, emphasizing Java 17 adoption, Jakarta EE 9 integration, and enhanced observability. Here are some of the standout features:

 

Java 17 Enhancements:

  • Spring Boot 3 adopts Java 17 as its baseline.
  • Records allow the quick creation of data carrier classes.
  • Text Blocks simplify multi-line string creation.
  • Switch Expressions and Pattern Matching enhance conditional logic.
  • Sealed Classes limit inheritance to specified subclasses.

 

Major Focus Areas:

  • Native Executables: Spring Boot 3 emphasizes native executables for GraalVM, integrating the Spring Native initiative into core Spring.
  • Observability: Spring 6 introduces a new observability initiative, leveraging Micrometer for efficient metric recording and tracing.

 

Jakarta EE 9 Transition and dependencies:

  • The namespace shifts from javax.* to jakarta.*, necessitating code import adjustments.
  • Spring Boot 3 and Spring Framework 6 mandate minimum versions: Kotlin 1.7+, Lombok 1.18.22+, and Gradle 7.3+.

 

Spring Web MVC Updates:

  • New support for RFC7807 is added.
  • `HttpMethod` transitions from an enum to a class.
  • Outdated servlet-based integrations, like Commons FileUpload and Tiles, are phased out.

 

Migration Tips:

  • Begin by transitioning to Spring Boot 2.7.
  • Address deprecated code and configurations.
  • Shift to Java 17 and ensure third-party compatibility with Jakarta EE 9.

2. What is Azure Spring Apps

Azure Spring Apps, a collaboration between Microsoft and VMware, streamlines the development and deployment of Spring applications. Azure Spring Apps is designed to simplify Spring application development. This fully managed service allows developers to concentrate on their apps, eliminating the complexities of infrastructure management.

 

Azure Spring Apps offers various plans for different needs. The Enterprise Plan is for mission-critical workloads with VMware Tanzu components. The Basic Plan is for individual dev/test, while the Standard Plan caters to general production workloads. The Consumption Plan is pay-as-you-go and hosted in Azure Container Apps environments.

 

Key features include:

Infrastructure Management: Azure Spring Apps oversees the infrastructure, Java Development Kit, and vulnerability patching, ensuring app portability and compatibility with familiar tools.

 

Lifecycle Tools: The service offers comprehensive tools for monitoring, diagnostics, CI/CD, and blue-green deployments.

 

Advanced Support: Azure Spring Apps Enterprise introduces VMware Tanzu components tailored for enterprise needs and offers 24/7 support.

 

Security: Robust security features encompass secure access, communications, workload isolation, and user authentication.

 

Azure Integration: Developers can utilize Spring starters to seamlessly interact with Azure services like Azure Cosmos DB and Azure Active Directory.

 

Cost-Efficiency: Various pricing plans cater to different needs, from development/testing to mission-critical workloads.

 

You can refer more at https://azure.microsoft.com/products/spring-apps.

 

3. How to Run Spring Boot 3 Apps on Azure Spring Apps

Azure Spring Apps has expanded its support to include Spring Boot 3. To showcase this support, a dedicated sample for Spring Boot 3 has been provided, ensuring developers can seamlessly integrate and deploy their applications.

 

The sample in question is the well-known "PetClinic" application, which serves as an exemplar of the microservice architecture pattern. Deploying this sample to Azure Spring Apps offers a hands-on experience of the platform's capabilities. The architecture of the PetClinic application on Azure Spring Apps encompasses several components:

architecture.png

 

For developers eager to get started, the deployment process is straightforward. Here are some critical steps and code snippets:

 

  1. Prepare the Spring project:
    git clone https://github.com/Azure-Samples/spring-petclinic-microservices.git​
  2. Prepare the cloud environment: After signing in to the Azure portal, create an Azure Spring Apps instance. If it is the first time for you to create an Azure Spring Apps instance, please follow the official document.
  3. Deploy the apps to Azure Spring Apps: Navigate to the sample project directory and configure the apps for Azure Spring Apps:
    ./mvnw -P spring-apps com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:config
    ./mvnw azure-spring-apps:deploy​
  4. Validate the apps: Access the deployed applications using the provided URLs. For instance, the API Gateway's URL will be in the format: 
    https://<your-Azure-Spring-Apps-instance-name>-api-gateway.azuremicroservices.io.​

For a more detailed guide and advanced configurations, refer to the official doc Quickstart: Deploy microservice applications to Azure Spring Apps.

 

In conclusion, Azure Spring Apps' support for Spring Boot 3 underscores its adaptability and commitment to providing developers with the tools they need. The comprehensive documentation, coupled with practical samples like PetClinic, ensures that developers have a smooth experience from development to deployment.

 

freegrants.jpg

Additional Resources

 

Co-Authors
Version history
Last update:
‎Sep 12 2023 02:00 AM
Updated by: