August 22nd, 2024

Farewell Spring Cloud Azure 4.x, Hello 5.x: The Future is Now!

Spring Boot is evolving rapidly, and we’re continuously updating Spring Cloud Azure to keep pace. Spring Cloud Azure version 5.x has been available for a while, making it an opportune time to consider moving on from version 4.x. Let’s dive into the details and see what’s new in this release.

Why consider moving to 5.x?

Spring Cloud Azure 4.x was designed to be compatible with Spring Boot 2.x (versions 2.5.0-2.5.15, 2.6.0-2.6.15, and 2.7.0-2.7.18). This design ensured that all features and integrations provided by Spring Cloud Azure 4.x worked seamlessly with the Spring Boot 2.x series. However, with support for Spring Boot 2.7.18 ending in November 2023, version 4.x is ready for retirement. As of June 2024, we released the final version, 4.19.0, marking the end of this series. We’ll continue to provide support until June 2025, ensuring a smooth transition for your apps.

To ensure you’re using the right versions, refer to the Spring Versions Mapping for the corresponding Spring Cloud Azure version for your Spring Boot and Spring Cloud versions.

New features and improvements in 5.x

With the release of Spring Boot 3.x, Spring Cloud Azure has also leveled up. Since January 2023, there have been 17 releases, each adding new features and improvements. We’re committed to keeping this version in tip-top shape, ensuring it remains a robust, reliable choice for your cloud-native apps.

Support Spring Boot 3.3.0

The latest version, Spring Cloud Azure 5.15.0, provides full support for Spring Boot 3.3.0 and later versions, including compatibility with 3.0.0-3.0.13, 3.1.0-3.1.12, 3.2.0-3.2.7, and 3.3.0-3.3.2. This support allows you to use the latest features of Spring Boot 3.3 in your cloud-native apps. For detailed version support information, see the release notes. Additionally, in this version, the previous development branch feature/spring-boot-3 for Spring Boot 3 merged into the main branch, eliminating the development branch for Spring Boot 2. This change streamlines the development process and focuses our efforts on the latest Spring Boot versions.

Passwordless connection in Azure Cache for Redis

Remember the days of needing a password for authenticating to Azure Cache for Redis? Those days are over! With support for passwordless connections, you can now connect using Managed Identity or any Microsoft Entra ID principal. This feature not only simplifies the connection process but also enhances security.

To connect to Azure Cache for Redis with a passwordless connection, add the appropriate dependencies and enable passwordless in your application.properties file:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
  <groupId>com.azure.spring</groupId>
  <artifactId>spring-cloud-azure-starter-data-redis-lettuce</artifactId>
</dependency>
spring.data.redis.azure.passwordless-enabled=true

You can find more details from Use Azure Redis Cache in Spring or Spring Cloud Azure Redis support, or check out this sample.

Testcontainers support for Cosmos DB, Blobs, and Queues

In the latest released version 5.15, we’re adding support for Testcontainers Service Connection to Cosmos DB, Storage Blobs, and Storage Queues. This feature uses Spring Boot’s @ServiceConnection annotation to simplify the configuration and management of these services in integration tests. With the @ServiceConnection annotation, developers can easily connect to these services running inside Docker containers managed by Testcontainers. The connection details are automatically created and injected into the Spring Boot application context, ensuring that the app uses the correct connection settings.

@Testcontainers
@SpringBootTest
public class MyCosmosTests {

    @Container
    @ServiceConnection
    static CosmosDBEmulatorContainer cosmos = new CosmosDBEmulatorContainer(DockerImageName.parse("mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest"));

    // Your test methods here
}

In this example, the configured configuration allows Cosmos DB-related beans in the app to communicate with Cosmos DB running inside the Testcontainers-managed Docker container. This action is done by automatically defining a AzureCosmosConnectionDetails bean, which is then used by the Cosmos DB autoconfiguration, overriding any connection-related configuration properties.

Service connection annotations are processed by xxxContainerConnectionDetailsFactory classes registered with spring.factories. A xxxContainerConnectionDetailsFactory can create a ConnectionDetails bean based on a specific Container subclass, or the Docker image name. We first support CosmosContainerConnectionDetailsFactory, StorageBlobContainerConnectionDetailsFactory, and StorageQueueContainerConnectionDetailsFactory in the spring-cloud-azure-testcontainers jar.

Enhanced documentation and samples

Spring Cloud Azure 5.x also brings enhanced documentation and new samples to help you get the most out of its features. For instance, you can now find detailed guides using Spring Messaging, and examples for integrating Event Hubs, Service Bus, and Storage Queues with Spring Messaging. These resources make it simpler to build robust messaging solutions and apply the powerful capabilities of Azure services in your Spring apps.

Community and ecosystem

The Spring Cloud Azure community grows significantly, with more contributors and users sharing their experiences and solutions. This vibrant community provides a wealth of knowledge and resources, which includes forums, blogs, and GitHub repositories. You can find answers to your questions and collaborate with other developers here. The ecosystem around Spring Cloud Azure continues to expand, with new integrations and extensions being developed to support a wide range of use cases.

The roadmap of Spring Cloud Azure 5.x

  • We aim to complete the Spring support for Key Vault Java Cryptography Architecture (JCA), which includes:
    • Spring Boot Starter for Key Vault JCA: We plan to develop a dedicated starter for seamless integration of Key Vault JCA with Spring Boot 3.
    • SSLBundle Integration: Full support for SSLBundle is on the way, enhancing security and ease of use.
    • Certificate Chain Fixes: Addressing issues with intermediate certificate chains to ensure smoother and more reliable integrations.
  • A new major version is planned for release next year, which includes:
    • Enhanced Spring Boot Compatibility: We plan to improve compatibility with minor Spring Boot versions, providing a smoother experience for developers.
    • ConfigData API Support: We aim to integrate support for the ConfigData API, facilitating more robust and flexible configuration management.
    • Flexible Authentication Configuration: The new version offers finer controls and increased flexibility for configuring authentication across Azure components, empowering you with more options and security features.

Continuity and evolution of application configuration

Starting with Spring Cloud Azure 4.7, we introduced support for Azure App Configuration, continuing the support previously provided by the 2.x series for Spring Boot 2.x. However, as Spring Boot 2.x support ends, we also decide to phase out the 4.x series. While we continue to provide hotfixes for the final version, 4.19.0, until June 2025, we recommend that users still using App Configuration 2.x upgrade to 4.x.

Spring Cloud Azure 5.x latest version fully supports Spring Boot 3.3.0 and later versions. This series will continue to support the latest Spring Boot releases and introduce new features and improvements, making it ideal for building modern, cloud-native apps. We strongly encourage everyone to upgrade to 5.x for the best experience.

For more information, see the Migration Guide.

Feedback

Your feedback and contributions are always welcome on StackOverflow or GitHub.

Resources

To learn more about Spring Cloud Azure, we invite you to visit the following links:

Author

0 comments

Discussion are closed.