Skip to content

io microsphere spring cloud client service registry endpoint AbstractServiceRegistrationEndpoint

github-actions[bot] edited this page Jun 10, 2026 · 5 revisions

AbstractServiceRegistrationEndpoint

Type: Class | Module: microsphere-spring-cloud-commons | Package: io.microsphere.spring.cloud.client.service.registry.endpoint | Since: 1.0.0

Source: microsphere-spring-cloud-commons/src/main/java/io/microsphere/spring/cloud/client/service/registry/endpoint/AbstractServiceRegistrationEndpoint.java

Overview

Abstract Endpoint for Service Registration

Declaration

public abstract class AbstractServiceRegistrationEndpoint implements SmartInitializingSingleton, ApplicationListener<WebServerInitializedEvent>

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.18-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

Method Examples

afterSingletonsInstantiated

// Called automatically by the Spring container after all singletons are instantiated.
// Ensures registration, serviceRegistry, and serviceRegistration fields are populated.

onApplicationEvent

// Called automatically when the embedded web server has been initialized.
// After this event, the port and running state are available.

setRunning

boolean running = AbstractServiceRegistrationEndpoint.detectRunning(serviceRegistration);
if (endpoint.isRunning()) {
    // service is registered and running
}
endpoint.setRunning(true);  // mark service as running
endpoint.setRunning(false); // mark service as stopped

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-spring-cloud-commons</artifactId>
    <version>${microsphere-spring-cloud.version}</version>
</dependency>

Tip: Use the BOM (microsphere-spring-cloud-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.spring.cloud.client.service.registry.endpoint.AbstractServiceRegistrationEndpoint;

API Reference

Public Methods

Method Description
afterSingletonsInstantiated {@inheritDoc}
onApplicationEvent {@inheritDoc}
setRunning Detects whether the given AbstractAutoServiceRegistration is currently running.

Method Details

afterSingletonsInstantiated

public void afterSingletonsInstantiated()

{@inheritDoc}

Initializes the Registration, ServiceRegistry, and AbstractAutoServiceRegistration from available bean providers.

Example Usage:

`// Called automatically by the Spring container after all singletons are instantiated.
// Ensures registration, serviceRegistry, and serviceRegistration fields are populated.
`

onApplicationEvent

public void onApplicationEvent(WebServerInitializedEvent event)

{@inheritDoc}

Captures the web server port and detects the running state of the AbstractAutoServiceRegistration.

Example Usage:

`// Called automatically when the embedded web server has been initialized.
// After this event, the port and running state are available.
`

setRunning

public void setRunning(boolean running)

Detects whether the given AbstractAutoServiceRegistration is currently running.

Example Usage:

`boolean running = AbstractServiceRegistrationEndpoint.detectRunning(serviceRegistration);
`

This documentation was auto-generated from the source code of microsphere-spring-cloud.

Home

spring-cloud-commons

spring-cloud-openfeign

Clone this wiki locally