Spring Cloud Azure Samples
- The repository hold samples about using Spring Cloud Azure libraries.
- The main branch is using the latest stable version of Spring Cloud Azure. If you want to find sample about specific version of Spring Cloud Azure, please switch to corresponding tag in this repository.
All Samples in This Repo
Microsoft Entra ID
Azure App Configuration
Azure Cache
Azure Cosmos DB
Azure Event Hubs
Azure Key Vault
Azure Database for MySQL
Azure Database for PostgreSQL
Azure Service Bus
Azure Storage
Spring PetClinic
TestContainers Support
Getting Help
Introduction to Maven profiles
This project uses one pom file to manage the samples for Spring Cloud Azure 4.x and Spring Cloud Azure 5.x, the profile spring-cloud-azure-4.x
is activated by default.
The profile names ending with -4.x
are used to run the samples with Spring Cloud Azure 4.x and Spring Boot 2;
the profile names ending with -5.x
are used to run the samples with Spring Cloud Azure 5.x and Spring Boot 3. The profile names ending with 4.x
and 5.x
cannot be mixed at the same time.
Note:
- Profiles
native-5.x
and nativeTest-5.x
are variants of the two profiles native
and nativeTest
provided by spring-boot-starter-parent
of Spring Boot 3, and they have the same function. If you want to use this profile, please use it with the profile spring-cloud-azure-5.x
, such as mvn -P spring-cloud-azure-5.x,native-5.x native:compile
.
Samples for Spring Boot 3
Note: This section is used to convert the samples to run in Spring Boot 3, the branch feature/spring-boot-3
is no longer maintained.
Convert samples to use Spring Boot 3
To get samples for Spring Boot 3, please refer to the content in each sample's README.md like this:
Current sample is using Spring Cloud Azure 4.x (which is compatible with Spring Boot 2.x).
If you want sample about Spring Cloud Azure 5.x (which is compatible with Spring Boot 3.x),
please refer to CONVERT_SAMPLE_TO_USE_SPRING_BOOT_3.md.
Mostly samples can work with both Spring Cloud Azure 4.x and Spring Cloud Azure 5.x, you can directly activate the profile of Spring Cloud Azure 5.x to run.
If you're adding a new example, here's a template that converts the example to support Spring Boot 3: ./CONVERT_SAMPLE_TO_USE_SPRING_BOOT_3_TEMPLATE.md.
Run samples with Maven command
Use below command to enable the profile for Spring Cloud Azure 5.x.
mvn clean spring-boot:run -P spring-cloud-azure-5.x
Run samples with IDE
Activate the profile Spring Cloud Azure 5.x by default, then you can run in your IDE tool.
Remove the below activation for spring-cloud-azure-4.x
, and add it to profile spring-cloud-azure-5.x
:
<activation>
<activeByDefault>true</activeByDefault>
</activation>