Skip to content

io microsphere spring cloud client discovery condition ConditionalOnBlockingDiscoveryAvailable

github-actions[bot] edited this page Jun 10, 2026 · 1 revision

ConditionalOnBlockingDiscoveryAvailable

Type: Annotation | Module: microsphere-spring-cloud-commons | Package: io.microsphere.spring.cloud.client.discovery.condition | Since: 1.0.0

Source: microsphere-spring-cloud-commons/src/main/java/io/microsphere/spring/cloud/client/discovery/condition/ConditionalOnBlockingDiscoveryAvailable.java

Overview

A condition that checks if Blocking Spring Cloud Discovery is available.

This annotation combines ConditionalOnClass (checking for the presence of DiscoveryClient), ConditionalOnDiscoveryEnabled, and ConditionalOnBlockingDiscoveryEnabled to ensure that the discovery client is both present in the classpath and enabled for blocking operations.

Example Usage:

{@code

### Declaration

```java
public @interface ConditionalOnBlockingDiscoveryAvailable
```

**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

```java
@Configuration
@ConditionalOnDiscoveryAvailable
public class DiscoveryClientConfiguration {

    @Bean
    public MyService myService(DiscoveryClient discoveryClient) {
        return new MyService(discoveryClient);
    }
}
```

## Usage

### Maven Dependency

Add the following dependency to your `pom.xml`:

```xml

    io.github.microsphere-projects
    microsphere-spring-cloud-commons
    ${microsphere-spring-cloud.version}

```

> **Tip:** Use the BOM (`microsphere-spring-cloud-dependencies`) for consistent version management. See the [Getting Started](https://github.com/microsphere-projects/microsphere-spring-cloud#getting-started) guide.

### Import

```java
import io.microsphere.spring.cloud.client.discovery.condition.ConditionalOnBlockingDiscoveryAvailable;
```

## See Also

- `ConditionalOnDiscoveryEnabled`
- `ConditionalOnBlockingDiscoveryEnabled`
- `ConditionalOnClass`

---

*This documentation was auto-generated from the source code of [microsphere-spring-cloud](https://github.com/microsphere-projects/microsphere-spring-cloud).*

Home

spring-cloud-commons

spring-cloud-openfeign

Clone this wiki locally