Integrate Azure and Spring with Spring Cloud Azure
Written by Nikos Vaggalis   
Monday, 09 May 2022

Spring Cloud Azure is an open-source project that provides seamless Spring integration with Azure services. It has now reached version 4.0.

Not to be confused with Azure Spring Cloud. which is a fully managed Spring Cloud service on Azure,Spring Cloud Azure is just an SDK that offers a convenient way to interact with Azure-provided services using well-known Spring idioms and APIs for Spring developers.

Spring Cloud Azure is a slightly vague term, but in essence it collectively brings together under one umbrella the following components:

Spring Cloud 

  • Spring Cloud Stream Binder for Azure Event Hubs (native API and Apache Kafka API)
  • Spring Cloud Stream Binder for Azure Service Bus Topic and Queue
  • Spring Resource Abstraction for Azure Storage
  • Spring Cache auto-configuration for Azure Cache for Redis
  • Spring Cloud Functions in Azure
  • Spring Cloud Config for Azure App Configuration 

 

Spring Boot 

  • Spring Boot Starter for Azure Active Directory
  • Spring Boot Starter for Azure Key Vault
  • Spring Boot Starter for Azure Storage store
  • Spring Boot Starter for Azure Active Directory B2C
  • Spring Boot Starter for Azure Cosmos DB
  • Spring Boot Starter for Azure Service Bus
  • Spring Boot Starter for Azure Service Bus with JMS
  • Spring Boot Starter for Azure Event Hubs 

 

Spring Data 

  • Spring Data JPA - Azure MySQL, Azure PostgreSQL, Microsoft SQL Server
  • Spring Data JDBC - Azure MySQL, Azure PostgreSQL, Microsoft SQL Server
  • Spring Data MongoDB - Azure MongoDB (via Azure Cosmos DB)
  • Spring Data for Apache Cassandra - Azure Cassandra (via Azure CosmosDB)
  • Spring Data Azure Cosmos DB - Azure Cosmos DB
  • Spring Data Redis - Azure Cache for Redis 

Spring Integration 

  • Inbound Channel Adapter and Message Handler for Azure Event Hubs
  • Inbound Channel Adapter and Message Handler for Azure Service Bus Topic and Queue
  • Message Source and Message Handler for Azure Storage Queue 

Version 4 is a significant milestone that brings better security and support for production readiness amongst others. With version 4 released, support for the older versions of 3.x.x which have all reached end of life, is dropped.

The changes to v4 since 3.10 are:

Unified Development Experience by unifying project name, artifact ID and properties under com.azure.spring.

Simplified dependency management by codifying the best practices and expertise from Spring experts and condensing all of dependency BOMs into one, spring-cloud-azure-dependencies.Adding the Spring Cloud Azure BOM to your application is as simple as:

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-dependencies</artifactId>
<version>4.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

More flexible Spring programming model by rearchitecting the Spring module dependencies from the ground up to make them a better fit with different approaches,for instance using Spring Cloud Azure client libraries to interact with Azure Event Hubs.

More control and security by enabling the so called credential chain, a way of

allowing applications to obtain credentials from application properties, environment variables, managed identity, IDEs, etc., all of which promote securing your apps in a zero-trust programing model.

More options exposed in a Spring idiomatic way by improving autoconfiguration coverage of Azure SDK clients for both synchronous and asynchronous scenarios, for example: 

  • spring.cloud.azure.<azure-service>.client
    To configure the transport clients underneath one Azure service SDK.
  • spring.cloud.azure.<azure-service>.credential
    To configure how to authenticate with Azure Active Directory for one Azure service SDK.
  • spring.cloud.azure.<azure-service>.profile
    To configure the Azure cloud environment for one Azure service SDK.
  • spring.cloud.azure.<azure-service>.proxy
    To configure the proxy options for one Azure service SDK.
  • spring.cloud.azure.<azure-service>.retry
    To configure the retry options apply to one Azure service SDK. The retry options has supported part of the SDKs, there’s no spring.cloud.azure.cosmos.retry.

 

Expanding support scope to further services Event Hubs, Azure Cache for Redis and App Configuration

Other than the release itself,the accompanying documentation and code samples were updated too.Spring Cloud Azure Samples and Animal Rescue are two such repos.

Finally,Spring Cloud Azure version 4 requires Spring Boot 2.6x and Spring Cloud version 2021.0.x, so make sure you upgrade those too.

 

More Information

Spring Cloud Azure 4.0 reference documentation

Related Articles

Ngrok Spring Boot Starter - Tunneling The Easy Way

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


AWS Adds Support For Llama2 And Mistral To SageMaker Canvas
12/03/2024

As part of its effort to enable its customers to use generative AI for tasks such as content generation and summarization, Amazon has added these state of the art LLMs to SageMaker Canvas.



Chainguard Joins Docker Verified Publisher Program
15/03/2024

Chainguard has joined the Docker Verified Publisher (DVP) program, meaning its Chainguard Developer Images are now officially available on Docker's container image registry.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 09 May 2022 )