ConditionalOnCloudPlatform class
Registers a bean only when the application runs on a given cloud platform, such as Kubernetes.
For beans that only make sense on one platform: health probes on
Kubernetes, a log format a platform's collector expects. The platform
is detected from the environment variables it sets, or forced with
spring.main.cloud-platform (useful in tests, or none to turn
detection off).
// Probes for the kubelet; not registered on a laptop.
@Bean()
@ConditionalOnCloudPlatform(CloudPlatform.kubernetes)
Probes probes() => Probes();
Spring (Java): @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES).
- Implemented types
Constructors
- ConditionalOnCloudPlatform(CloudPlatform platform)
-
Requires
platformto be the active platform.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- platform → CloudPlatform
-
The platform the application must run on.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
matches(
ConditionContext context) → bool -
Whether the annotated bean should be registered;
contextgives access to the configuration and the definitions registered so far.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited