Current version is 2.13.0, click here for the index

Spring Cloud for Azure AutoConfigure client library for Java

This package is for Spring Cloud Starters of Azure services. It helps Spring Cloud developers to adopt Azure services.

Source code | Package (Maven) | API reference documentation

Getting started

Prerequisites

Include the Package

  1. [Add azure-spring-cloud-dependencies].
  2. Add dependency. <version> can be skipped because we already add azure-spring-cloud-dependencies.
<dependency>
  <groupId>com.azure.spring</groupId>
  <artifactId>azure-spring-cloud-autoconfigure</artifactId>
</dependency>

Key concepts

This project provides auto-configuration for the following Azure services:

Health indicator

You can use health information to check the status of your running application. It is often used by monitoring software to alert someone when a production system goes down. The information exposed by the health endpoint depends on the management.endpoint.health.show-details and management.endpoint.health.show-components properties which can be configured with one of the following values:

| key | Name | | ---- | ---- | | never | Details are never shown. | | when-authorized | Details are only shown to authorized users. Authorized roles can be configured using management.endpoint.health.roles. | | always |Details are shown to all users. |

The default value is never. A user is considered to be authorized when they are in one or more of the endpoint’s roles. If the endpoint has no configured roles (the default) all authenticated users are considered to be authorized. The roles can be configured using the management.endpoint.health.roles property.

NOTE: If you have secured your application and wish to use always, your security configuration must permit access to the health endpoint for both authenticated and unauthenticated users.

Auto-configured HealthIndicators

The following HealthIndicators are auto-configured by Azure Spring Boot when appropriate. You can also enable/disable selected indicators by configuring management.health.key.enabled, with the key listed in the table below.

| key | Name | Description | | ---- | ---- | ---- | | binders | EventHubHealthIndicator | Checks that an event hub is up. | | binders | ServiceBusQueueHealthIndicator | Checks that a service bus queue is up. | | binders | ServiceBusTopicHealthIndicator | Checks that a service bus topic is up. |

Add the dependent

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
    </dependencies>

Enabling the Actuator

When you do the following configuration in application.yml , you can access the endpoint to get the health of the component.

management:
  health:
    binders:
      enabled: true
  endpoint:
    health:
      show-details: always

Access the Health Endpoint:

{
  "status": "UP",
  "components": {
    "binders": {
      "status": "UP",
      "components": {
        "eventhub-1": {
          "status": "UP"
        },
        "servicebus-1": {
          "status": "UP"
        }
      }
    }
  }
}

Examples

The following section provides sample projects illustrating how to use the Spring Cloud for Azure starters.

More sample code

Troubleshooting

Logging setting

Please refer to [spring logging document] to get more information about logging.

Logging setting examples

  • Example: Setting logging level of hibernate
logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR

Next steps

The following section provides sample projects illustrating how to use the Spring Cloud for Azure starters.

More sample code

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.

Packages 
Package Description
com.azure.spring.cloud.autoconfigure.cache
Package com.azure.spring.cloud.autoconfigure.cache;
com.azure.spring.cloud.autoconfigure.cloudfoundry
Package com.azure.spring.cloud.autoconfigure.cloudfoundry;
com.azure.spring.cloud.autoconfigure.eventhub
Package com.azure.spring.cloud.autoconfigure.eventhub;
com.azure.spring.cloud.autoconfigure.servicebus
Package com.azure.spring.cloud.autoconfigure.servicebus;