Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 3.93 KB

File metadata and controls

80 lines (54 loc) · 3.93 KB
title Discover and Register Your Spring Boot Applications in Azure Spring Apps
description Discover and register your Spring Boot applications with managed Spring Cloud Service Registry (OSS) in Azure Spring Apps.
author KarlErickson
ms.author karler
ms.service azure-spring-apps
ms.topic how-to
ms.date 08/19/2025
ms.update-cycle 1095-days
ms.custom devx-track-java, devx-track-extended-java, engagement-fy23
zone_pivot_groups programming-languages-spring-apps

Discover and register your Spring Boot applications

[!INCLUDE deprecation-note]

This article applies to: ✅ Basic/Standard ❎ Enterprise

This article shows you how to register your application using Spring Cloud Service Registry.

Service registration and discovery are key requirements for maintaining a list of live app instances to call, and routing and load balancing inbound requests. Configuring each client manually takes time and introduces the possibility of human error. Azure Spring Apps provides two options for you to solve this problem:

  • Use Kubernetes Service Discovery approach to invoke calls among your apps.

    Azure Spring Apps creates a corresponding Kubernetes service for every app running in it using the app name as the Kubernetes service name. You can invoke calls from one app to another app by using the app name in an HTTP/HTTPS request such as http(s)://{app name}/path. This approach is also suitable for the Enterprise plan. For more information, see the Kubernetes registry code sample.

  • Use Managed Spring Cloud Service Registry (OSS) in Azure Spring Apps.

    After configuration, a Service Registry server will control service registration and discovery for your applications. The Service Registry server maintains a registry of live app instances, enables client-side load-balancing, and decouples service providers from clients without relying on DNS.

::: zone pivot="programming-language-csharp"

For information about how to set up service registration for a Steeltoe app, see Prepare a Java Spring application for deployment in Azure Spring Apps.

::: zone-end

::: zone pivot="programming-language-java"

Register your application using Spring Cloud Service Registry

Before your application can manage service registration and discovery using Spring Cloud Service Registry, you must include the following dependency for spring-cloud-starter-netflix-eureka-client in your pom.xml file:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

Update the top level class

Finally, add an annotation to the top level class of your application, as shown in the following example:

package foo.bar;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
@EnableEurekaClient
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

The Spring Cloud Service Registry server endpoint is injected as an environment variable in your application. Applications can register themselves with the Service Registry server and discover other dependent applications.

Note

It can take a few minutes for the changes to propagate from the server to all applications. ::: zone-end

Next steps

In this article, you learned how to register your application using Spring Cloud Service Registry. To learn how to access the Spring Cloud Service Registry using Microsoft Entra role-based access control (RBAC), see Access Config Server and Service Registry.