Skip to content

io microsphere alibaba sentinel spring boot condition ConditionalOnSentinelAvailable

github-actions[bot] edited this page Jul 5, 2026 · 2 revisions

ConditionalOnSentinelAvailable

Type: Annotation | Module: microsphere-alibaba-sentinel-spring-boot | Package: io.microsphere.alibaba.sentinel.spring.boot.condition | Since: 1.0.0

Source: microsphere-alibaba-sentinel-spring-boot/src/main/java/io/microsphere/alibaba/sentinel/spring/boot/condition/ConditionalOnSentinelAvailable.java

Overview

Indicates that a component is eligible for registration when Alibaba Sentinel is available.

This annotation combines ConditionalOnSentinelEnabled @ConditionalOnSentinelEnabled and ConditionalOnClass @ConditionalOnClass(name = {"com.alibaba.csp.sentinel.SphU" , "io.microsphere.alibaba.sentinel.common.SentinelPlugin")}, meaning the annotated component will be registered only if Sentinel is explicitly enabled and the Sentinel core classes are present on the classpath.

Example Usage

{@code

### Declaration

```java
public @interface ConditionalOnSentinelAvailable
```

**Author:** Mercy

## Version Information

- **Introduced in:** `1.0.0`
- **Current Project Version:** `0.2.0-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
@ConditionalOnSentinelAvailiable
public class MySentinelConfiguration {
    // This configuration will only be active if Sentinel is available
}
```

## Usage

### Maven Dependency

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

```xml

    io.github.microsphere-projects
    microsphere-alibaba-sentinel-spring-boot
    ${microsphere-alibaba-sentinel.version}

```

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

### Import

```java
import io.microsphere.alibaba.sentinel.spring.boot.condition.ConditionalOnSentinelAvailable;
```

## See Also

- `SentinelRedisAutoConfiguration`

---

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

Clone this wiki locally