Azure Spring Boot client library for Java - Version 3.3.0
This repo is for Spring Boot Starters of Azure services. It helps Spring Boot developers to adopt Azure services.
Source code | Package (Maven) | API reference documentation | Product documentation | Samples
Getting started
Prerequisites
Include the Package
To start a new project using Azure, go on start.spring.io and select "Azure Support": this will configure the project to make sure you can integrate easily with Azure service.
For instance, let's assume that you want to use Key Vault secrets, you can add the usual azure-security-keyvault-secrets
dependency to your project and the Spring Boot auto-configuration will kick-in:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
</dependency>
Note that there is no need to add a version
as those are managed already by the project.
Alternatively you may want to use the starters
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-boot-starter-keyvault-secrets</artifactId>
<version>3.3.0</version>
</dependency>
Key concepts
This project provides auto-configuration for the following Azure services:
- Azure Active Directory
- Azure Active Directory B2C
- Cosmos DB SQL API
- Gremlin SQL API
- Key Vault Secrets
- Metrics Service
- JMS Service Bus
This module also provides the ability to automatically inject credentials from Cloud Foundry into your
applications consuming Azure services. It does this by reading the VCAP_SERVICES
environment
variable and setting the appropriate properties used by auto-configuration code.
For details, please see sample code in the azure-spring-boot-sample-cloud-foundry
Examples
The following section provides sample projects illustrating how to use the Azure Spring Boot starters.
More sample code
- Azure Active Directory for Web Application
- Azure Active Directory for Resource Server
- Azure Active Directory for Resource Server with Obo Clients
- Azure Active Directory for Resource Server by Filter(Deprecated)
- Azure Active Directory B2C
- Cosmos DB SQL API
- Gremlin SQL API
- Key Vault
- JMS Service Bus Queue
- JMS Service Bus Topic
Troubleshooting
Enable client logging
Azure SDKs for Java offers a consistent logging story to help aid in troubleshooting application errors and expedite their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate the root issue. View the logging wiki for guidance about enabling logging.
Enable Spring logging
Spring allow all the supported logging systems to set logger levels set in the Spring Environment (for example, in application.properties) by using logging.level.<logger-name>=<level>
where level is one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, or OFF. The root logger can be configured by using logging.level.root.
The following example shows potential logging settings in application.properties
:
logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
For more information about setting logging in spring, please refer to the official doc.
Next steps
The following section provides sample projects illustrating how to use the Azure Spring Boot starters.
More sample code
- Azure Active Directory for Web Application
- Azure Active Directory for Resource Server
- Azure Active Directory for Resource Server with Obo Clients
- Azure Active Directory for Resource Server by Filter(Deprecated)
- Azure Active Directory B2C
- Cosmos DB SQL API
- Gremlin SQL API
- Key Vault
- JMS Service Bus Queue
- JMS Service Bus Topic
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
Please follow instructions here to build from source or contribute.
If you encounter any bug, please file an issue here.
To suggest a new feature or changes that could be made, file an issue the same way you would for a bug.