diff --git a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/Conditional.java b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/Conditional.java index a073b2f5a..abb5dcf39 100644 --- a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/Conditional.java +++ b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/Conditional.java @@ -25,7 +25,7 @@ * * @since 1.0.0 */ -@Target({ElementType.TYPE}) +@Target({ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Conditional { diff --git a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/ConditionalComposite.java b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/ConditionalComposite.java new file mode 100644 index 000000000..cc6bc3dbb --- /dev/null +++ b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/ConditionalComposite.java @@ -0,0 +1,28 @@ +/* + * Copyright © ${year} ${owner} (${email}) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jd.live.agent.core.extension.annotation; + +import java.lang.annotation.*; + +/** + * An annotation used to mark an annotation type as a conditional composite. + */ +@Target({ElementType.ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ConditionalComposite { + +} diff --git a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/ConditionalOnMissingClass.java b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/ConditionalOnMissingClass.java index 6b502cdf1..8e80043af 100644 --- a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/ConditionalOnMissingClass.java +++ b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/annotation/ConditionalOnMissingClass.java @@ -30,6 +30,7 @@ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) +@Repeatable(ConditionalOnMissingClasses.class) @Documented @Conditional(dependOnLoader = true) public @interface ConditionalOnMissingClass { diff --git a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/condition/Condition.java b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/condition/Condition.java index c8065d3e8..4713b1832 100644 --- a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/condition/Condition.java +++ b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/condition/Condition.java @@ -15,6 +15,11 @@ */ package com.jd.live.agent.core.extension.condition; +import lombok.Getter; + +import java.lang.annotation.Annotation; +import java.util.List; + /** * condition matcher */ @@ -28,4 +33,56 @@ public interface Condition { */ boolean match(ConditionContext context); + /** + * A condition that delegates the condition matching to a provided condition. + * + * @see Condition + * @see ConditionContext + */ + @Getter + class DelegateCondition implements Condition { + + private final Annotation annotation; + + private final Condition condition; + + public DelegateCondition(Annotation annotation, Condition condition) { + this.annotation = annotation; + this.condition = condition; + } + + @Override + public boolean match(ConditionContext context) { + return condition.match(context.getAnnotation() == annotation ? context : context.create(annotation)); + } + } + + /** + * A composite condition that checks if all of its sub-conditions are met. + *
+ * This class represents a composite condition that consists of multiple sub-conditions. The condition is considered
+ * satisfied if and only if all of its sub-conditions are satisfied.
+ *
+ * @see Condition
+ * @see ConditionContext
+ */
+ class CompositeCondition implements Condition {
+
+ private final List extends Condition> conditions;
+
+ public CompositeCondition(List extends Condition> conditions) {
+ this.conditions = conditions;
+ }
+
+ @Override
+ public boolean match(ConditionContext context) {
+ for (Condition condition : conditions) {
+ if (!condition.match(context)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/condition/ConditionManager.java b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/condition/ConditionManager.java
index dd0a9f79e..acb825825 100644
--- a/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/condition/ConditionManager.java
+++ b/joylive-core/joylive-core-api/src/main/java/com/jd/live/agent/core/extension/condition/ConditionManager.java
@@ -18,12 +18,17 @@
import com.jd.live.agent.bootstrap.logger.Logger;
import com.jd.live.agent.bootstrap.logger.LoggerFactory;
import com.jd.live.agent.core.extension.annotation.Conditional;
-import com.jd.live.agent.core.util.cache.LazyObject;
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.Extension;
+import com.jd.live.agent.core.extension.condition.Condition.CompositeCondition;
+import com.jd.live.agent.core.extension.condition.Condition.DelegateCondition;
+import com.jd.live.agent.core.inject.annotation.Injectable;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
@@ -49,9 +54,9 @@ public class ConditionManager implements ConditionMatcher {
private static final String CONDITION_PACKAGE = ConditionManager.class.getPackage().getName();
- private static final Map
+ * This method uses a cache to store conditions for annotation types. If the condition for the given annotation type
+ * is not in the cache, it creates a new condition using the provided function and stores it in the cache. The
+ * function takes the annotation type as input and returns a new condition.
+ *
+ * @param type the annotation type to retrieve a condition for
+ * @param function a function that creates a new condition for the given annotation type
+ * @return a condition for the given annotation type, or null if the condition could not be created
+ */
+ private Condition getCondition(Class> type, Function This class is used internally by the {@link ConditionManager} to cache and manage the relationship between
- * annotations and their corresponding conditions, enabling efficient conditional matching.
+ * This annotation is used to indicate that a type requires the dubbo rpc feature to be enabled. The presence of this
+ * annotation on a type will trigger specific behavior in the governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnDubboEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnFlowControlEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnFlowControlEnabled.java
new file mode 100644
index 000000000..c4bc0a7d7
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnFlowControlEnabled.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring the flow control feature to be enabled.
+ *
+ * This annotation is used to indicate that a type requires the flow control feature to be enabled. The presence of this
+ * annotation on a type will trigger specific behavior in the governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnFlowControlEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnGovernanceEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnGovernanceEnabled.java
new file mode 100644
index 000000000..43d20828d
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnGovernanceEnabled.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperties;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.core.extension.annotation.ConditionalRelation;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring at least one of the specified governance features to be enabled.
+ *
+ * This annotation is used to indicate that a type requires at least one of the specified governance features to be
+ * enabled. The presence of this annotation on a type will trigger specific behavior in the governance processing
+ * logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperties(value = {
+ @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
+ @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
+ @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
+}, relation = ConditionalRelation.OR)
+@ConditionalComposite
+public @interface ConditionalOnGovernanceEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnMqEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnMqEnabled.java
new file mode 100644
index 000000000..f8762b7fa
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnMqEnabled.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring the mq feature to be enabled.
+ *
+ * This annotation is used to indicate that a type requires the mq feature to be enabled. The presence of this
+ * annotation on a type will trigger specific behavior in the governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnMqEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnOnlyRouteEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnOnlyRouteEnabled.java
new file mode 100644
index 000000000..e7a22bbd0
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnOnlyRouteEnabled.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.core.extension.annotation.ConditionalRelation;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring either the live or lane feature to be enabled, and the flow control
+ * feature to be disabled.
+ *
+ * This annotation is used to indicate that a type requires either the live or lane feature to be enabled, and the flow
+ * control feature to be disabled. The presence of this annotation on a type will trigger specific behavior in the
+ * governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(name = {
+ GovernanceConfig.CONFIG_LIVE_ENABLED,
+ GovernanceConfig.CONFIG_LANE_ENABLED
+}, matchIfMissing = true, relation = ConditionalRelation.OR)
+@ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, value = "false")
+@ConditionalComposite
+public @interface ConditionalOnOnlyRouteEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnProtectEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnProtectEnabled.java
new file mode 100644
index 000000000..027daf3cd
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnProtectEnabled.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring either the protect feature to be enabled, and the flow control
+ * feature to be disabled.
+ *
+ * This annotation is used to indicate that a type requires either the protect feature to be enabled, and the flow
+ * control feature to be disabled. The presence of this annotation on a type will trigger specific behavior in the
+ * governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
+@ConditionalComposite
+public @interface ConditionalOnProtectEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnReactive.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnReactive.java
new file mode 100644
index 000000000..b88870a74
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnReactive.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnClass(ConditionalOnReactive.REACTOR_MONO)
+@ConditionalComposite
+public @interface ConditionalOnReactive {
+
+ String REACTOR_MONO = "reactor.core.publisher.Mono";
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnRocketmqEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnRocketmqEnabled.java
new file mode 100644
index 000000000..5dad6e77f
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnRocketmqEnabled.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring the rocketmq feature to be enabled.
+ *
+ * This annotation is used to indicate that a type requires the rocketmq feature to be enabled. The presence of this
+ * annotation on a type will trigger specific behavior in the governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnRocketmqEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringEnabled.java
new file mode 100644
index 000000000..8b04c1d4f
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringEnabled.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring the spring framework feature to be enabled.
+ *
+ * This annotation is used to indicate that a type requires the spring framework feature to be enabled. The presence of this
+ * annotation on a type will trigger specific behavior in the governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnSpringEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringGatewayEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringGatewayEnabled.java
new file mode 100644
index 000000000..bd5b813ff
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringGatewayEnabled.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring the spring gateway feature to be enabled.
+ *
+ * This annotation is used to indicate that a type requires the spring gateway feature to be enabled. The presence of this
+ * annotation on a type will trigger specific behavior in the governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_GATEWAY_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnSpringGatewayEnabled {
+
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringRetry.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringRetry.java
new file mode 100644
index 000000000..fe5fc0298
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnSpringRetry.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring the spring retry feature to be enabled.
+ *
+ * This annotation is used to indicate that a type requires the spring retry feature to be enabled. The presence of this
+ * annotation on a type will trigger specific behavior in the governance processing logic.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnClass(ConditionalOnSpringRetry.TYPE_RETRY_TEMPLATE)
+@ConditionalComposite
+public @interface ConditionalOnSpringRetry {
+
+ String TYPE_RETRY_TEMPLATE = "org.springframework.retry.support.RetryTemplate";
+}
diff --git a/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnTransmissionEnabled.java b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnTransmissionEnabled.java
new file mode 100644
index 000000000..a9fd8d9b1
--- /dev/null
+++ b/joylive-core/joylive-governance-api/src/main/java/com/jd/live/agent/governance/annotation/ConditionalOnTransmissionEnabled.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.governance.annotation;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring specific conditions related to transmission to be met.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnTransmissionEnabled {
+
+}
diff --git a/joylive-plugin/joylive-application/joylive-application-springboot2/src/main/java/com/jd/live/agent/plugin/application/springboot/v2/definition/ApplicationContextDefinition.java b/joylive-plugin/joylive-application/joylive-application-springboot2/src/main/java/com/jd/live/agent/plugin/application/springboot/v2/definition/ApplicationContextDefinition.java
index 1a92c056c..ca3b1c81d 100644
--- a/joylive-plugin/joylive-application/joylive-application-springboot2/src/main/java/com/jd/live/agent/plugin/application/springboot/v2/definition/ApplicationContextDefinition.java
+++ b/joylive-plugin/joylive-application/joylive-application-springboot2/src/main/java/com/jd/live/agent/plugin/application/springboot/v2/definition/ApplicationContextDefinition.java
@@ -18,24 +18,21 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.event.AgentEvent;
import com.jd.live.agent.core.event.Publisher;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
import com.jd.live.agent.plugin.application.springboot.v2.interceptor.ContextStopInterceptor;
@Injectable
@Extension(value = "ApplicationContextDefinition_v5", order = PluginDefinition.ORDER_APPLICATION)
+@ConditionalOnGovernanceEnabled
@ConditionalOnClass(ApplicationContextDefinition.TYPE_ABSTRACT_APPLICATION_CONTEXT)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
public class ApplicationContextDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_ABSTRACT_APPLICATION_CONTEXT = "org.springframework.context.support.AbstractApplicationContext";
diff --git a/joylive-plugin/joylive-application/joylive-application-springboot2/src/main/java/com/jd/live/agent/plugin/application/springboot/v2/definition/SpringApplicationDefinition.java b/joylive-plugin/joylive-application/joylive-application-springboot2/src/main/java/com/jd/live/agent/plugin/application/springboot/v2/definition/SpringApplicationDefinition.java
index d95293814..cbccf7c87 100644
--- a/joylive-plugin/joylive-application/joylive-application-springboot2/src/main/java/com/jd/live/agent/plugin/application/springboot/v2/definition/SpringApplicationDefinition.java
+++ b/joylive-plugin/joylive-application/joylive-application-springboot2/src/main/java/com/jd/live/agent/plugin/application/springboot/v2/definition/SpringApplicationDefinition.java
@@ -18,26 +18,23 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.event.AgentEvent;
import com.jd.live.agent.core.event.Publisher;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
import com.jd.live.agent.governance.policy.PolicySupervisor;
import com.jd.live.agent.plugin.application.springboot.v2.interceptor.ApplicationReadyInterceptor;
import com.jd.live.agent.plugin.application.springboot.v2.interceptor.ApplicationStartedInterceptor;
@Injectable
@Extension(value = "SpringApplicationDefinition_v5", order = PluginDefinition.ORDER_APPLICATION)
+@ConditionalOnGovernanceEnabled
@ConditionalOnClass(SpringApplicationDefinition.TYPE_SPRING_APPLICATION_RUN_LISTENERS)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
public class SpringApplicationDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_SPRING_APPLICATION_RUN_LISTENERS = "org.springframework.boot.SpringApplicationRunListeners";
diff --git a/joylive-plugin/joylive-protection/joylive-protection-mariadb2/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v2/condition/ConditionalOnMariadbProtectEnabled.java b/joylive-plugin/joylive-protection/joylive-protection-mariadb2/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v2/condition/ConditionalOnMariadbProtectEnabled.java
new file mode 100644
index 000000000..40b9d2301
--- /dev/null
+++ b/joylive-plugin/joylive-protection/joylive-protection-mariadb2/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v2/condition/ConditionalOnMariadbProtectEnabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.protection.mariadb.v2.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnProtectEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProtectEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_MARIADB_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnMariadbProtectEnabled {
+
+}
diff --git a/joylive-plugin/joylive-protection/joylive-protection-mariadb2/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v2/definition/AbstractQueryProtocolDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-mariadb2/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v2/definition/AbstractQueryProtocolDefinition.java
index e0228105e..639b59501 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-mariadb2/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v2/definition/AbstractQueryProtocolDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-mariadb2/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v2/definition/AbstractQueryProtocolDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,8 +24,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.mariadb.v2.condition.ConditionalOnMariadbProtectEnabled;
import com.jd.live.agent.plugin.protection.mariadb.v2.interceptor.ExecuteBatchStmtInterceptor;
import com.jd.live.agent.plugin.protection.mariadb.v2.interceptor.ExecutePrepareInterceptor;
import com.jd.live.agent.plugin.protection.mariadb.v2.interceptor.ExecuteQueryInterceptor;
@@ -34,9 +33,7 @@
@Injectable
@Extension(value = "StandardClientDefinition_v2", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_MARIADB_ENABLED, matchIfMissing = true)
+@ConditionalOnMariadbProtectEnabled
@ConditionalOnClass(AbstractQueryProtocolDefinition.TYPE_ABSTRACT_QUERY_PROTOCOL)
public class AbstractQueryProtocolDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-protection/joylive-protection-mariadb3/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v3/condition/ConditionalOnMariadbProtectEnabled.java b/joylive-plugin/joylive-protection/joylive-protection-mariadb3/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v3/condition/ConditionalOnMariadbProtectEnabled.java
new file mode 100644
index 000000000..4bb5d0bf7
--- /dev/null
+++ b/joylive-plugin/joylive-protection/joylive-protection-mariadb3/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v3/condition/ConditionalOnMariadbProtectEnabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.protection.mariadb.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnProtectEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProtectEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_MARIADB_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnMariadbProtectEnabled {
+
+}
diff --git a/joylive-plugin/joylive-protection/joylive-protection-mariadb3/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v3/definition/StandardClientDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-mariadb3/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v3/definition/StandardClientDefinition.java
index 3a9ec72b0..09b85eef2 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-mariadb3/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v3/definition/StandardClientDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-mariadb3/src/main/java/com/jd/live/agent/plugin/protection/mariadb/v3/definition/StandardClientDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,15 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.mariadb.v3.condition.ConditionalOnMariadbProtectEnabled;
import com.jd.live.agent.plugin.protection.mariadb.v3.interceptor.SendQueryInterceptor;
@Injectable
@Extension(value = "StandardClientDefinition_v3", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_MARIADB_ENABLED, matchIfMissing = true)
+@ConditionalOnMariadbProtectEnabled
@ConditionalOnClass(StandardClientDefinition.TYPE_STANDARD_CLIENT)
public class StandardClientDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/condition/ConditionalOnMongodbProtectEnabled.java b/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/condition/ConditionalOnMongodbProtectEnabled.java
new file mode 100644
index 000000000..cb1641de0
--- /dev/null
+++ b/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/condition/ConditionalOnMongodbProtectEnabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.protection.mongodb.v4.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnProtectEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProtectEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_MONGODB_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnMongodbProtectEnabled {
+
+}
diff --git a/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/definition/CommandOperationHelperDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/definition/CommandOperationHelperDefinition.java
index 87e710e14..b95f9eeaa 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/definition/CommandOperationHelperDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/definition/CommandOperationHelperDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,15 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.mongodb.v4.condition.ConditionalOnMongodbProtectEnabled;
import com.jd.live.agent.plugin.protection.mongodb.v4.interceptor.ExecuteCommandInterceptor;
@Injectable
@Extension(value = "CommandOperationHelperDefinition_v4", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_MONGODB_ENABLED, matchIfMissing = true)
+@ConditionalOnMongodbProtectEnabled
@ConditionalOnClass(CommandOperationHelperDefinition.TYPE_COMMAND_OPERATION_HELPER)
public class CommandOperationHelperDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/definition/MixedBulkWriteOperationDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/definition/MixedBulkWriteOperationDefinition.java
index 1ad3266d1..5a4a79506 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/definition/MixedBulkWriteOperationDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-mongodb4/src/main/java/com/jd/live/agent/plugin/protection/mongodb/v4/definition/MixedBulkWriteOperationDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,15 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.mongodb.v4.condition.ConditionalOnMongodbProtectEnabled;
import com.jd.live.agent.plugin.protection.mongodb.v4.interceptor.MixedBulkWriteOperationInterceptor;
@Injectable
@Extension(value = "MixedBulkWriteOperationDefinition_v4", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_MONGODB_ENABLED, matchIfMissing = true)
+@ConditionalOnMongodbProtectEnabled
@ConditionalOnClass(MixedBulkWriteOperationDefinition.TYPE_COMMAND_OPERATION_HELPER)
public class MixedBulkWriteOperationDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-protection/joylive-protection-opengauss3.0/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_0/condition/ConditionalOnOpenGauss30ProtectEnabled.java b/joylive-plugin/joylive-protection/joylive-protection-opengauss3.0/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_0/condition/ConditionalOnOpenGauss30ProtectEnabled.java
new file mode 100644
index 000000000..6e1c0294b
--- /dev/null
+++ b/joylive-plugin/joylive-protection/joylive-protection-opengauss3.0/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_0/condition/ConditionalOnOpenGauss30ProtectEnabled.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.protection.opengauss.v3_0.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnProtectEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProtectEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_OPENGAUSS_ENABLED, matchIfMissing = true)
+@ConditionalOnMissingClass(ConditionalOnOpenGauss30ProtectEnabled.TYPE_SLF4J_LOGGER)
+@ConditionalComposite
+public @interface ConditionalOnOpenGauss30ProtectEnabled {
+
+ String TYPE_SLF4J_LOGGER = "org.postgresql.log.Slf4JLogger";
+
+}
diff --git a/joylive-plugin/joylive-protection/joylive-protection-opengauss3.0/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_0/definition/QueryExecutorImplDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-opengauss3.0/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_0/definition/QueryExecutorImplDefinition.java
index 0d2827691..ee4a6ccff 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-opengauss3.0/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_0/definition/QueryExecutorImplDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-opengauss3.0/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_0/definition/QueryExecutorImplDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,15 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.opengauss.v3_0.condition.ConditionalOnOpenGauss30ProtectEnabled;
import com.jd.live.agent.plugin.protection.opengauss.v3_0.interceptor.QueryExecutorImplInterceptor;
@Injectable
@Extension(value = "QueryExecutorImplDefinition_v3.0", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_OPENGAUSS_ENABLED, matchIfMissing = true)
+@ConditionalOnOpenGauss30ProtectEnabled
@ConditionalOnClass(QueryExecutorImplDefinition.TYPE_QUERY_EXECUTOR_IMPL)
public class QueryExecutorImplDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-protection/joylive-protection-opengauss3.1/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_1/condition/ConditionalOnOpenGauss31ProtectEnabled.java b/joylive-plugin/joylive-protection/joylive-protection-opengauss3.1/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_1/condition/ConditionalOnOpenGauss31ProtectEnabled.java
new file mode 100644
index 000000000..0b1f4c0e4
--- /dev/null
+++ b/joylive-plugin/joylive-protection/joylive-protection-opengauss3.1/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_1/condition/ConditionalOnOpenGauss31ProtectEnabled.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.protection.opengauss.v3_1.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnProtectEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProtectEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_OPENGAUSS_ENABLED, matchIfMissing = true)
+@ConditionalOnClass(ConditionalOnOpenGauss31ProtectEnabled.TYPE_SLF4J_LOGGER)
+@ConditionalComposite
+public @interface ConditionalOnOpenGauss31ProtectEnabled {
+
+ String TYPE_SLF4J_LOGGER = "org.postgresql.log.Slf4JLogger";
+}
diff --git a/joylive-plugin/joylive-protection/joylive-protection-opengauss3.1/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_1/definition/QueryExecutorImplDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-opengauss3.1/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_1/definition/QueryExecutorImplDefinition.java
index 289e4453b..0445f6f32 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-opengauss3.1/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_1/definition/QueryExecutorImplDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-opengauss3.1/src/main/java/com/jd/live/agent/plugin/protection/opengauss/v3_1/definition/QueryExecutorImplDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,23 +24,18 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.opengauss.v3_1.condition.ConditionalOnOpenGauss31ProtectEnabled;
import com.jd.live.agent.plugin.protection.opengauss.v3_1.interceptor.QueryExecutorImplInterceptor;
@Injectable
@Extension(value = "QueryExecutorImplDefinition_v3.1", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_OPENGAUSS_ENABLED, matchIfMissing = true)
+@ConditionalOnOpenGauss31ProtectEnabled
@ConditionalOnClass(QueryExecutorImplDefinition.TYPE_QUERY_EXECUTOR_IMPL)
-@ConditionalOnClass(QueryExecutorImplDefinition.TYPE_SLF4J_LOGGER)
public class QueryExecutorImplDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_QUERY_EXECUTOR_IMPL = "org.postgresql.core.v3.QueryExecutorImpl";
- protected static final String TYPE_SLF4J_LOGGER = "org.postgresql.log.Slf4JLogger";
-
private static final String METHOD_SEND_QUERY = "sendQuery";
private static final String[] ARGUMENT_SEND_QUERY = {
diff --git a/joylive-plugin/joylive-protection/joylive-protection-postgresql42/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v42/condition/ConditionalOnPostgresqlProtectEnabled.java b/joylive-plugin/joylive-protection/joylive-protection-postgresql42/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v42/condition/ConditionalOnPostgresqlProtectEnabled.java
new file mode 100644
index 000000000..fdd0e9067
--- /dev/null
+++ b/joylive-plugin/joylive-protection/joylive-protection-postgresql42/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v42/condition/ConditionalOnPostgresqlProtectEnabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.protection.postgresql.v42.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnProtectEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProtectEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_POSTGRESQL_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnPostgresqlProtectEnabled {
+
+}
diff --git a/joylive-plugin/joylive-protection/joylive-protection-postgresql42/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v42/definition/QueryExecutorImplDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-postgresql42/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v42/definition/QueryExecutorImplDefinition.java
index 52f680855..f3d533d82 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-postgresql42/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v42/definition/QueryExecutorImplDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-postgresql42/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v42/definition/QueryExecutorImplDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,15 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.postgresql.v42.condition.ConditionalOnPostgresqlProtectEnabled;
import com.jd.live.agent.plugin.protection.postgresql.v42.interceptor.QueryExecutorImplInterceptor;
@Injectable
@Extension(value = "QueryExecutorImplDefinition_v42", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_POSTGRESQL_ENABLED, matchIfMissing = true)
+@ConditionalOnPostgresqlProtectEnabled
@ConditionalOnClass(QueryExecutorImplDefinition.TYPE_QUERY_EXECUTOR_IMPL)
public class QueryExecutorImplDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-protection/joylive-protection-postgresql9.4/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v9_4/condition/ConditionalOnPostgresqlProtectEnabled.java b/joylive-plugin/joylive-protection/joylive-protection-postgresql9.4/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v9_4/condition/ConditionalOnPostgresqlProtectEnabled.java
new file mode 100644
index 000000000..e9196dd23
--- /dev/null
+++ b/joylive-plugin/joylive-protection/joylive-protection-postgresql9.4/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v9_4/condition/ConditionalOnPostgresqlProtectEnabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.protection.postgresql.v9_4.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnProtectEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProtectEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_POSTGRESQL_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnPostgresqlProtectEnabled {
+
+}
diff --git a/joylive-plugin/joylive-protection/joylive-protection-postgresql9.4/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v9_4/definition/QueryExecutorImplDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-postgresql9.4/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v9_4/definition/QueryExecutorImplDefinition.java
index 78df6ab20..43e4da06a 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-postgresql9.4/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v9_4/definition/QueryExecutorImplDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-postgresql9.4/src/main/java/com/jd/live/agent/plugin/protection/postgresql/v9_4/definition/QueryExecutorImplDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,15 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.postgresql.v9_4.condition.ConditionalOnPostgresqlProtectEnabled;
import com.jd.live.agent.plugin.protection.postgresql.v9_4.interceptor.QueryExecutorImplInterceptor;
@Injectable
@Extension(value = "QueryExecutorImplDefinition_v9.4", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_POSTGRESQL_ENABLED, matchIfMissing = true)
+@ConditionalOnPostgresqlProtectEnabled
@ConditionalOnClass(QueryExecutorImplDefinition.TYPE_QUERY_EXECUTOR_IMPL)
public class QueryExecutorImplDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-protection/joylive-protection-redis/src/main/java/com/jd/live/agent/plugin/protection/redis/condition/ConditionalOnRedisProtectEnabled.java b/joylive-plugin/joylive-protection/joylive-protection-redis/src/main/java/com/jd/live/agent/plugin/protection/redis/condition/ConditionalOnRedisProtectEnabled.java
new file mode 100644
index 000000000..b4ae56138
--- /dev/null
+++ b/joylive-plugin/joylive-protection/joylive-protection-redis/src/main/java/com/jd/live/agent/plugin/protection/redis/condition/ConditionalOnRedisProtectEnabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.protection.redis.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnProtectEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProtectEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_REDIS_ENABLED)
+@ConditionalComposite
+public @interface ConditionalOnRedisProtectEnabled {
+
+}
diff --git a/joylive-plugin/joylive-protection/joylive-protection-redis/src/main/java/com/jd/live/agent/plugin/protection/redis/definition/JedisConnectionDefinition.java b/joylive-plugin/joylive-protection/joylive-protection-redis/src/main/java/com/jd/live/agent/plugin/protection/redis/definition/JedisConnectionDefinition.java
index 13b863450..6224689ad 100644
--- a/joylive-plugin/joylive-protection/joylive-protection-redis/src/main/java/com/jd/live/agent/plugin/protection/redis/definition/JedisConnectionDefinition.java
+++ b/joylive-plugin/joylive-protection/joylive-protection-redis/src/main/java/com/jd/live/agent/plugin/protection/redis/definition/JedisConnectionDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,15 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.protection.redis.condition.ConditionalOnRedisProtectEnabled;
import com.jd.live.agent.plugin.protection.redis.interceptor.JedisConnectionInterceptor;
@Injectable
@Extension(value = "JedisConnectionDefinition", order = PluginDefinition.ORDER_PROTECT)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_PROTECT_REDIS_ENABLED)
+@ConditionalOnRedisProtectEnabled
@ConditionalOnClass(JedisConnectionDefinition.TYPE_JEDIS)
public class JedisConnectionDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/condition/ConditionalOnDubbo26Enabled.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/condition/ConditionalOnDubbo26Enabled.java
new file mode 100644
index 000000000..b0175d793
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/condition/ConditionalOnDubbo26Enabled.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.dubbo.v2_6.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnDubboEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubboEnabled
+@ConditionalOnMissingClass(ConditionalOnDubbo26Enabled.TYPE_REFERENCE_CONFIG)
+@ConditionalComposite
+public @interface ConditionalOnDubbo26Enabled {
+
+ String TYPE_REFERENCE_CONFIG = "org.apache.dubbo.config.ReferenceConfig";
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/condition/ConditionalOnDubbo26GovernanceEnabled.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/condition/ConditionalOnDubbo26GovernanceEnabled.java
new file mode 100644
index 000000000..c61dbc526
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/condition/ConditionalOnDubbo26GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.dubbo.v2_6.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo26Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo26GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/ReferenceConfigDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/ReferenceConfigDefinition.java
index da28bf2fd..b8c86ac10 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/ReferenceConfigDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/ReferenceConfigDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.registry.dubbo.v2_6.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -24,8 +25,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.registry.dubbo.v2_6.condition.ConditionalOnDubbo26GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v2_6.interceptor.ReferenceConfigInterceptor;
/**
@@ -33,11 +34,7 @@
*/
@Injectable
@Extension(value = "ReferenceConfigDefinition_v2.6", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnDubbo26GovernanceEnabled
@ConditionalOnClass(ReferenceConfigDefinition.TYPE_REFERENCE_CONFIG)
public class ReferenceConfigDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/RegistryDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/RegistryDefinition.java
index 39bebb84e..4738b46a2 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/RegistryDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/RegistryDefinition.java
@@ -17,7 +17,8 @@
import com.jd.live.agent.core.bootstrap.AgentLifecycle;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -25,8 +26,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.registry.Registry;
+import com.jd.live.agent.plugin.registry.dubbo.v2_6.condition.ConditionalOnDubbo26GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v2_6.interceptor.RegistryInterceptor;
/**
@@ -34,12 +35,7 @@
*/
@Injectable
@Extension(value = "RegistryDefinition_v2.6", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnClass(ReferenceConfigDefinition.TYPE_REFERENCE_CONFIG)
+@ConditionalOnDubbo26GovernanceEnabled
@ConditionalOnClass(RegistryDefinition.TYPE_FAILBACK_REGISTRY)
public class RegistryDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/ServiceConfigDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/ServiceConfigDefinition.java
index 6ebae75d1..1ab4275af 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/ServiceConfigDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.6/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_6/definition/ServiceConfigDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.registry.dubbo.v2_6.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -24,8 +25,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.registry.dubbo.v2_6.condition.ConditionalOnDubbo26GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v2_6.interceptor.ServiceConfigInterceptor;
/**
@@ -33,11 +34,7 @@
*/
@Injectable
@Extension(value = "ServiceConfigDefinition_v2.6", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnDubbo26GovernanceEnabled
@ConditionalOnClass(ServiceConfigDefinition.TYPE_SERVICE_CONFIG)
public class ServiceConfigDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/condition/ConditionalOnDubbo27Enabled.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/condition/ConditionalOnDubbo27Enabled.java
new file mode 100644
index 000000000..3e1042f74
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/condition/ConditionalOnDubbo27Enabled.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.dubbo.v2_7.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnDubboEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubboEnabled
+@ConditionalOnMissingClass(ConditionalOnDubbo27Enabled.TYPE_PROTOCOL_FILTER_WRAPPER)
+@ConditionalComposite
+public @interface ConditionalOnDubbo27Enabled {
+
+ String TYPE_PROTOCOL_FILTER_WRAPPER = "org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper";
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/condition/ConditionalOnDubbo27GovernanceEnabled.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/condition/ConditionalOnDubbo27GovernanceEnabled.java
new file mode 100644
index 000000000..8d8e8153c
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/condition/ConditionalOnDubbo27GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.dubbo.v2_7.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo27Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo27GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/ReferenceConfigDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/ReferenceConfigDefinition.java
index cd3379b71..609dd16b8 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/ReferenceConfigDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/ReferenceConfigDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.registry.dubbo.v2_7.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -24,8 +25,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.registry.dubbo.v2_7.condition.ConditionalOnDubbo27GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v2_7.interceptor.ReferenceConfigInterceptor;
/**
@@ -33,19 +34,12 @@
*/
@Injectable
@Extension(value = "ServiceConfigDefinition_v2.7", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnClass(ReferenceConfigDefinition.TYPE_PROTOCOL_FILTER_WRAPPER)
+@ConditionalOnDubbo27GovernanceEnabled
@ConditionalOnClass(ReferenceConfigDefinition.TYPE_REFERENCE_CONFIG)
public class ReferenceConfigDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_REFERENCE_CONFIG = "org.apache.dubbo.config.ReferenceConfig";
- protected static final String TYPE_PROTOCOL_FILTER_WRAPPER = "org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper";
-
private static final String METHOD_CREATE_PROXY = "createProxy";
private static final String[] ARGUMENT_CREATE_PROXY = new String[]{
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/RegistryDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/RegistryDefinition.java
index e580bc79c..588fed5f5 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/RegistryDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/RegistryDefinition.java
@@ -17,7 +17,8 @@
import com.jd.live.agent.core.bootstrap.AgentLifecycle;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -25,8 +26,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.registry.Registry;
+import com.jd.live.agent.plugin.registry.dubbo.v2_7.condition.ConditionalOnDubbo27GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v2_7.interceptor.RegistryInterceptor;
import java.util.*;
@@ -36,12 +37,7 @@
*/
@Injectable
@Extension(value = "RegistryDefinition_v2.7", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnClass(ReferenceConfigDefinition.TYPE_PROTOCOL_FILTER_WRAPPER)
+@ConditionalOnDubbo27GovernanceEnabled
@ConditionalOnClass(RegistryDefinition.TYPE_SERVICE_DISCOVERY)
public class RegistryDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/ServiceConfigDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/ServiceConfigDefinition.java
index a3cdb4e61..822bf1b23 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/ServiceConfigDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo2.7/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v2_7/definition/ServiceConfigDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.registry.dubbo.v2_7.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -24,8 +25,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.registry.dubbo.v2_7.condition.ConditionalOnDubbo27GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v2_7.interceptor.ServiceConfigInterceptor;
/**
@@ -33,12 +34,7 @@
*/
@Injectable
@Extension(value = "ServiceConfigDefinition_v2.7", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnClass(ReferenceConfigDefinition.TYPE_PROTOCOL_FILTER_WRAPPER)
+@ConditionalOnDubbo27GovernanceEnabled
@ConditionalOnClass(ServiceConfigDefinition.TYPE_SERVICE_CONFIG)
public class ServiceConfigDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/condition/ConditionalOnDubbo3Enabled.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/condition/ConditionalOnDubbo3Enabled.java
new file mode 100644
index 000000000..6bc22bbac
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/condition/ConditionalOnDubbo3Enabled.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.dubbo.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnDubboEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubboEnabled
+@ConditionalOnMissingClass(ConditionalOnDubbo3Enabled.TYPE_CONSUMER_CONTEXT_FILTER)
+@ConditionalComposite
+public @interface ConditionalOnDubbo3Enabled {
+
+ String TYPE_CONSUMER_CONTEXT_FILTER = "org.apache.dubbo.rpc.cluster.filter.support.ConsumerContextFilter";
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/condition/ConditionalOnDubbo3GovernanceEnabled.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/condition/ConditionalOnDubbo3GovernanceEnabled.java
new file mode 100644
index 000000000..e5c6cd363
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/condition/ConditionalOnDubbo3GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.dubbo.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo3Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo3GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/ReferenceConfigDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/ReferenceConfigDefinition.java
index 150986bf2..b9eb0af60 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/ReferenceConfigDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/ReferenceConfigDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.registry.dubbo.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -24,8 +25,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.registry.dubbo.v3.condition.ConditionalOnDubbo3GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v3.interceptor.ReferenceConfigInterceptor;
/**
@@ -33,12 +34,7 @@
*/
@Injectable
@Extension(value = "ReferenceConfigDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnClass(ServiceConfigDefinition.TYPE_CONSUMER_CONTEXT_FILTER)
+@ConditionalOnDubbo3GovernanceEnabled
@ConditionalOnClass(ReferenceConfigDefinition.TYPE_REFERENCE_CONFIG)
public class ReferenceConfigDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/RegistryDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/RegistryDefinition.java
index 1d8c2f7d1..07d52c006 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/RegistryDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/RegistryDefinition.java
@@ -17,7 +17,8 @@
import com.jd.live.agent.core.bootstrap.AgentLifecycle;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -25,8 +26,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.registry.Registry;
+import com.jd.live.agent.plugin.registry.dubbo.v3.condition.ConditionalOnDubbo3GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v3.interceptor.RegistryInterceptor;
import java.util.*;
@@ -36,12 +37,7 @@
*/
@Injectable
@Extension(value = "RegistryDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnClass(ServiceConfigDefinition.TYPE_CONSUMER_CONTEXT_FILTER)
+@ConditionalOnDubbo3GovernanceEnabled
@ConditionalOnClass(RegistryDefinition.TYPE_SERVICE_DISCOVERY)
public class RegistryDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/ServiceConfigDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/ServiceConfigDefinition.java
index f1d0ccae2..8b5b5e095 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/ServiceConfigDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-dubbo3/src/main/java/com/jd/live/agent/plugin/registry/dubbo/v3/definition/ServiceConfigDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.registry.dubbo.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -24,8 +25,8 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.registry.dubbo.v3.condition.ConditionalOnDubbo3GovernanceEnabled;
import com.jd.live.agent.plugin.registry.dubbo.v3.interceptor.ServiceConfigInterceptor;
/**
@@ -33,17 +34,10 @@
*/
@Injectable
@Extension(value = "ServiceConfigDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnClass(ServiceConfigDefinition.TYPE_CONSUMER_CONTEXT_FILTER)
+@ConditionalOnDubbo3GovernanceEnabled
@ConditionalOnClass(ServiceConfigDefinition.TYPE_SERVICE_CONFIG)
public class ServiceConfigDefinition extends PluginDefinitionAdapter {
- protected static final String TYPE_CONSUMER_CONTEXT_FILTER = "org.apache.dubbo.rpc.cluster.filter.support.ConsumerContextFilter";
-
protected static final String TYPE_SERVICE_CONFIG = "org.apache.dubbo.config.ServiceConfig";
private static final String METHOD_BUILD_ATTRIBUTES = "buildAttributes";
diff --git a/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/ConsumerBootstrapDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/ConsumerBootstrapDefinition.java
index 80e24ca19..a51290fa1 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/ConsumerBootstrapDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/ConsumerBootstrapDefinition.java
@@ -16,12 +16,13 @@
package com.jd.live.agent.plugin.registry.sofarpc.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
import com.jd.live.agent.core.plugin.definition.*;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
import com.jd.live.agent.governance.policy.PolicySupplier;
import com.jd.live.agent.plugin.registry.sofarpc.interceptor.ConsumerBootstrapInterceptor;
@@ -33,11 +34,7 @@
*/
@Injectable
@Extension(value = "ConsumerBootstrapDefinition", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnGovernanceEnabled
@ConditionalOnClass(ConsumerBootstrapDefinition.TYPE_CONSUMER_BOOTSTRAP)
public class ConsumerBootstrapDefinition extends PluginDefinitionAdapter implements PluginImporter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/ProviderBootstrapDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/ProviderBootstrapDefinition.java
index 7dcd98f67..9c6d95843 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/ProviderBootstrapDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/ProviderBootstrapDefinition.java
@@ -16,12 +16,13 @@
package com.jd.live.agent.plugin.registry.sofarpc.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
import com.jd.live.agent.core.plugin.definition.*;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
import com.jd.live.agent.governance.policy.PolicySupplier;
import com.jd.live.agent.plugin.registry.sofarpc.interceptor.ProviderBootstrapInterceptor;
@@ -33,11 +34,7 @@
*/
@Injectable
@Extension(value = "ProviderBootstrapDefinition", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnGovernanceEnabled
@ConditionalOnClass(ProviderBootstrapDefinition.TYPE_PROVIDER_BOOTSTRAP)
public class ProviderBootstrapDefinition extends PluginDefinitionAdapter implements PluginImporter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/RegistryDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/RegistryDefinition.java
index 0be63358c..ae3388724 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/RegistryDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-sofarpc/src/main/java/com/jd/live/agent/plugin/registry/sofarpc/definition/RegistryDefinition.java
@@ -17,7 +17,8 @@
import com.jd.live.agent.core.bootstrap.AgentLifecycle;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -25,7 +26,7 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
import com.jd.live.agent.governance.registry.Registry;
import com.jd.live.agent.plugin.registry.sofarpc.interceptor.RegistryInterceptor;
@@ -36,11 +37,7 @@
*/
@Injectable
@Extension(value = "RegistryDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnGovernanceEnabled
@ConditionalOnClass(RegistryDefinition.TYPE_REGISTRY)
public class RegistryDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/DiscoveryClientDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/DiscoveryClientDefinition.java
index b99711155..3ab3af408 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/DiscoveryClientDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/DiscoveryClientDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.registry.springcloud.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
import com.jd.live.agent.governance.policy.PolicySupplier;
import com.jd.live.agent.plugin.registry.springcloud.v3.interceptor.DiscoveryClientConstructorInterceptor;
import com.jd.live.agent.plugin.registry.springcloud.v3.interceptor.DiscoveryClientGetInterceptor;
@@ -33,11 +34,7 @@
*/
@Injectable
@Extension(value = "DiscoveryClientDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnGovernanceEnabled
@ConditionalOnClass(DiscoveryClientDefinition.TYPE_DISCOVERY_CLIENT)
public class DiscoveryClientDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/FeignClientFactoryBeanDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/FeignClientFactoryBeanDefinition.java
index 60da1478e..26ac5e74b 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/FeignClientFactoryBeanDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/FeignClientFactoryBeanDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.registry.springcloud.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
import com.jd.live.agent.governance.policy.PolicySupplier;
import com.jd.live.agent.plugin.registry.springcloud.v3.interceptor.FeignClientFactoryBeanInterceptor;
@@ -32,11 +33,7 @@
*/
@Injectable
@Extension(value = "FeignClientFactoryBeanDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnGovernanceEnabled
@ConditionalOnClass(FeignClientFactoryBeanDefinition.TYPE_FEIGN_CLIENT_FACTORY_BEAN)
public class FeignClientFactoryBeanDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/RegistryDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/RegistryDefinition.java
index 6f8b9797f..3b511de50 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/RegistryDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-springcloud3/src/main/java/com/jd/live/agent/plugin/registry/springcloud/v3/definition/RegistryDefinition.java
@@ -17,7 +17,8 @@
import com.jd.live.agent.core.bootstrap.AgentLifecycle;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.instance.Application;
@@ -25,7 +26,7 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
import com.jd.live.agent.governance.policy.PolicySupplier;
import com.jd.live.agent.governance.registry.Registry;
import com.jd.live.agent.plugin.registry.springcloud.v3.interceptor.RegistryInterceptor;
@@ -38,11 +39,7 @@
*/
@Injectable
@Extension(value = "ServiceRegistryDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnGovernanceEnabled
@ConditionalOnClass(RegistryDefinition.TYPE_SERVICE_REGISTRY)
public class RegistryDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/condition/ConditionalOnSpringGateway3Enabled.java b/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/condition/ConditionalOnSpringGateway3Enabled.java
new file mode 100644
index 000000000..c11245740
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/condition/ConditionalOnSpringGateway3Enabled.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.springgateway.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnReactive;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringGatewayEnabled;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring specific conditions related to Spring Gateway to be met.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringGatewayEnabled
+@ConditionalOnReactive
+@ConditionalOnMissingClass(ConditionalOnSpringGateway3Enabled.TYPE_HTTP_HTTP_STATUS_CODE)
+@ConditionalComposite
+public @interface ConditionalOnSpringGateway3Enabled {
+
+ String TYPE_HTTP_HTTP_STATUS_CODE = "org.springframework.http.HttpStatusCode";
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/condition/ConditionalOnSpringGateway3GovernanceEnabled.java b/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/condition/ConditionalOnSpringGateway3GovernanceEnabled.java
new file mode 100644
index 000000000..936f2aa3c
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/condition/ConditionalOnSpringGateway3GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.springgateway.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringGateway3Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnSpringGateway3GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/definition/RouteDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/definition/RouteDefinition.java
index 0520e82d4..565a09458 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/definition/RouteDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-springgateway3/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v3/definition/RouteDefinition.java
@@ -16,15 +16,16 @@
package com.jd.live.agent.plugin.registry.springgateway.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.registry.springgateway.v3.condition.ConditionalOnSpringGateway3GovernanceEnabled;
import com.jd.live.agent.plugin.registry.springgateway.v3.interceptor.RouteInterceptor;
/**
@@ -32,19 +33,12 @@
*/
@Injectable
@Extension(value = "RouteDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnSpringGateway3GovernanceEnabled
@ConditionalOnClass(RouteDefinition.TYPE_ROUTE_DEFINITION_ROUTE_LOCATOR)
-@ConditionalOnMissingClass(RouteDefinition.TYPE_HTTP_STATUS_CODE)
public class RouteDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_ROUTE_DEFINITION_ROUTE_LOCATOR = "org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator";
- protected static final String TYPE_HTTP_STATUS_CODE = "org.springframework.http.HttpStatusCode";
-
private static final String METHOD_CONVERT_TO_ROUTE = "convertToRoute";
private static final String[] ARGUMENT_CONVERT_TO_ROUTE = new String[]{
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/condition/ConditionalOnSpringGateway4Enabled.java b/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/condition/ConditionalOnSpringGateway4Enabled.java
new file mode 100644
index 000000000..6393d4912
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/condition/ConditionalOnSpringGateway4Enabled.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.springgateway.v4.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnReactive;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringGatewayEnabled;
+
+import java.lang.annotation.*;
+
+/**
+ * An annotation used to mark a type as requiring specific conditions related to Spring Gateway to be met.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringGatewayEnabled
+@ConditionalOnReactive
+@ConditionalOnClass(ConditionalOnSpringGateway4Enabled.TYPE_HTTP_HTTP_STATUS_CODE)
+@ConditionalComposite
+public @interface ConditionalOnSpringGateway4Enabled {
+
+ String TYPE_HTTP_HTTP_STATUS_CODE = "org.springframework.http.HttpStatusCode";
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/condition/ConditionalOnSpringGateway4GovernanceEnabled.java b/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/condition/ConditionalOnSpringGateway4GovernanceEnabled.java
new file mode 100644
index 000000000..6a2ef67f3
--- /dev/null
+++ b/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/condition/ConditionalOnSpringGateway4GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.registry.springgateway.v4.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringGateway4Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnSpringGateway4GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/definition/RouteDefinition.java b/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/definition/RouteDefinition.java
index dd48bbee8..b54bf573b 100644
--- a/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/definition/RouteDefinition.java
+++ b/joylive-plugin/joylive-registry/joylive-registry-springgateway4/src/main/java/com/jd/live/agent/plugin/registry/springgateway/v4/definition/RouteDefinition.java
@@ -16,35 +16,29 @@
package com.jd.live.agent.plugin.registry.springgateway.v4.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.policy.PolicySupplier;
+import com.jd.live.agent.plugin.registry.springgateway.v4.condition.ConditionalOnSpringGateway4GovernanceEnabled;
import com.jd.live.agent.plugin.registry.springgateway.v4.interceptor.RouteInterceptor;
/**
* RouteDefinition
*/
@Injectable
-@Extension(value = "RouteDefinition_v3", order = PluginDefinition.ORDER_REGISTRY)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@Extension(value = "RouteDefinition_v4", order = PluginDefinition.ORDER_REGISTRY)
+@ConditionalOnSpringGateway4GovernanceEnabled
@ConditionalOnClass(RouteDefinition.TYPE_ROUTE_DEFINITION_ROUTE_LOCATOR)
-@ConditionalOnClass(RouteDefinition.TYPE_HTTP_STATUS_CODE)
public class RouteDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_ROUTE_DEFINITION_ROUTE_LOCATOR = "org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator";
- protected static final String TYPE_HTTP_STATUS_CODE = "org.springframework.http.HttpStatusCode";
-
private static final String METHOD_CONVERT_TO_ROUTE = "convertToRoute";
private static final String[] ARGUMENT_CONVERT_TO_ROUTE = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26Enabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26Enabled.java
new file mode 100644
index 000000000..aba509f1a
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26Enabled.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v2_6.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnDubboEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubboEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo26Enabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26FlowControlEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26FlowControlEnabled.java
new file mode 100644
index 000000000..1bae5879c
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26FlowControlEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v2_6.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnFlowControlEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo26Enabled
+@ConditionalOnFlowControlEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo26FlowControlEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26GovernanceEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26GovernanceEnabled.java
new file mode 100644
index 000000000..336eb386f
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v2_6.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo26Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo26GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26OnlyRouteEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26OnlyRouteEnabled.java
new file mode 100644
index 000000000..bc27fb19f
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/condition/ConditionalOnDubbo26OnlyRouteEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v2_6.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnOnlyRouteEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo26Enabled
+@ConditionalOnOnlyRouteEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo26OnlyRouteEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/ClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/ClusterDefinition.java
index 4833b27fe..452a761e3 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/ClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/ClusterDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,14 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v2_6.condition.ConditionalOnDubbo26FlowControlEnabled;
import com.jd.live.agent.plugin.router.dubbo.v2_6.interceptor.ClusterInterceptor;
@Injectable
@Extension(value = "ClusterDefinition_v2.6")
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
+@ConditionalOnDubbo26FlowControlEnabled
@ConditionalOnClass(ClusterDefinition.TYPE_ABSTRACT_CLUSTER)
public class ClusterDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/ExceptionFilterDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/ExceptionFilterDefinition.java
index ddb9eb811..7ebb3e560 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/ExceptionFilterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/ExceptionFilterDefinition.java
@@ -16,26 +16,20 @@
package com.jd.live.agent.plugin.router.dubbo.v2_6.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v2_6.condition.ConditionalOnDubbo26GovernanceEnabled;
import com.jd.live.agent.plugin.router.dubbo.v2_6.interceptor.ExceptionFilterInterceptor;
@Injectable
@Extension(value = "ExceptionFilterDefinition_v2.6")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED,
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnDubbo26GovernanceEnabled
@ConditionalOnClass(ExceptionFilterDefinition.TYPE_EXCEPTION_FILTER)
public class ExceptionFilterDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/LoadBalanceDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/LoadBalanceDefinition.java
index 9027b3d14..cf0cef5fd 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/LoadBalanceDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.6/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_6/definition/LoadBalanceDefinition.java
@@ -16,26 +16,20 @@
package com.jd.live.agent.plugin.router.dubbo.v2_6.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v2_6.condition.ConditionalOnDubbo26OnlyRouteEnabled;
import com.jd.live.agent.plugin.router.dubbo.v2_6.interceptor.LoadBalanceInterceptor;
@Injectable
@Extension(value = "LoadBalanceDefinition_v2.6")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, value = "false"),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnDubbo26OnlyRouteEnabled
@ConditionalOnClass(LoadBalanceDefinition.TYPE_ABSTRACT_CLUSTER)
public class LoadBalanceDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27Enabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27Enabled.java
new file mode 100644
index 000000000..1065fee30
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27Enabled.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v2_7.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnDubboEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubboEnabled
+@ConditionalOnClass(ConditionalOnDubbo27Enabled.TYPE_PROTOCOL_FILTER_WRAPPER)
+@ConditionalComposite
+public @interface ConditionalOnDubbo27Enabled {
+
+ String TYPE_PROTOCOL_FILTER_WRAPPER = "org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper";
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27FlowControlEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27FlowControlEnabled.java
new file mode 100644
index 000000000..4cf5ace6f
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27FlowControlEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v2_7.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnFlowControlEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo27Enabled
+@ConditionalOnFlowControlEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo27FlowControlEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27GovernanceEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27GovernanceEnabled.java
new file mode 100644
index 000000000..9f7b18d58
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v2_7.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo27Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo27GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27OnlyRouteEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27OnlyRouteEnabled.java
new file mode 100644
index 000000000..c41b38e73
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/condition/ConditionalOnDubbo27OnlyRouteEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v2_7.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnOnlyRouteEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo27Enabled
+@ConditionalOnOnlyRouteEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo27OnlyRouteEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/ClassLoaderFilterDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/ClassLoaderFilterDefinition.java
index df85c0f89..ebe209736 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/ClassLoaderFilterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/ClassLoaderFilterDefinition.java
@@ -16,34 +16,25 @@
package com.jd.live.agent.plugin.router.dubbo.v2_7.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v2_7.condition.ConditionalOnDubbo27GovernanceEnabled;
import com.jd.live.agent.plugin.router.dubbo.v2_7.interceptor.ClassLoaderFilterInterceptor;
@Injectable
@Extension(value = "ClassLoaderFilterDefinition_v2.7")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED,
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnDubbo27GovernanceEnabled
@ConditionalOnClass(ClassLoaderFilterDefinition.TYPE_CLASSLOADER_FILTER)
-@ConditionalOnClass(ClassLoaderFilterDefinition.TYPE_PROTOCOL_FILTER_WRAPPER)
public class ClassLoaderFilterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_CLASSLOADER_FILTER = "org.apache.dubbo.rpc.filter.ClassLoaderFilter";
- protected static final String TYPE_PROTOCOL_FILTER_WRAPPER = "org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper";
-
private static final String METHOD_INVOKE = "invoke";
protected static final String[] ARGUMENT_INVOKE = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/ClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/ClusterDefinition.java
index a1c120756..c1d525e49 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/ClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/ClusterDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,16 +24,14 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v2_7.condition.ConditionalOnDubbo27FlowControlEnabled;
import com.jd.live.agent.plugin.router.dubbo.v2_7.interceptor.ClusterInterceptor;
@Injectable
@Extension(value = "ClusterDefinition_v2.7")
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
+@ConditionalOnDubbo27FlowControlEnabled
@ConditionalOnClass(ClusterDefinition.TYPE_ABSTRACT_CLUSTER)
-@ConditionalOnClass(ClassLoaderFilterDefinition.TYPE_PROTOCOL_FILTER_WRAPPER)
public class ClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_ABSTRACT_CLUSTER = "org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker";
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/LoadBalanceDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/LoadBalanceDefinition.java
index d897dc3a9..8dfcd7c32 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/LoadBalanceDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo2.7/src/main/java/com/jd/live/agent/plugin/router/dubbo/v2_7/definition/LoadBalanceDefinition.java
@@ -16,28 +16,21 @@
package com.jd.live.agent.plugin.router.dubbo.v2_7.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v2_7.condition.ConditionalOnDubbo27OnlyRouteEnabled;
import com.jd.live.agent.plugin.router.dubbo.v2_7.interceptor.LoadBalanceInterceptor;
@Injectable
@Extension(value = "LoadBalanceDefinition_v2.7")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, value = "false"),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnDubbo27OnlyRouteEnabled
@ConditionalOnClass(LoadBalanceDefinition.TYPE_ABSTRACT_CLUSTER)
-@ConditionalOnClass(ClassLoaderFilterDefinition.TYPE_PROTOCOL_FILTER_WRAPPER)
public class LoadBalanceDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_ABSTRACT_CLUSTER = "com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker";
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3Enabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3Enabled.java
new file mode 100644
index 000000000..71b9d6511
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3Enabled.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnDubboEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubboEnabled
+@ConditionalOnClass(ConditionalOnDubbo3Enabled.TYPE_CONSUMER_CLASSLOADER_FILTER)
+@ConditionalComposite
+public @interface ConditionalOnDubbo3Enabled {
+
+ String TYPE_CONSUMER_CLASSLOADER_FILTER = "org.apache.dubbo.rpc.cluster.filter.support.ConsumerClassLoaderFilter";
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3FlowControlEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3FlowControlEnabled.java
new file mode 100644
index 000000000..acd5e09f6
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3FlowControlEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnFlowControlEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo3Enabled
+@ConditionalOnFlowControlEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo3FlowControlEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3GovernanceEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3GovernanceEnabled.java
new file mode 100644
index 000000000..4d45d88f7
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo3Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo3GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3OnlyRouteEnabled.java b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3OnlyRouteEnabled.java
new file mode 100644
index 000000000..f3d58c66f
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/condition/ConditionalOnDubbo3OnlyRouteEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.dubbo.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnOnlyRouteEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnDubbo3Enabled
+@ConditionalOnOnlyRouteEnabled
+@ConditionalComposite
+public @interface ConditionalOnDubbo3OnlyRouteEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/ClassLoaderFilterDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/ClassLoaderFilterDefinition.java
index a7f4b6026..ec58578d4 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/ClassLoaderFilterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/ClassLoaderFilterDefinition.java
@@ -16,34 +16,25 @@
package com.jd.live.agent.plugin.router.dubbo.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v3.condition.ConditionalOnDubbo3GovernanceEnabled;
import com.jd.live.agent.plugin.router.dubbo.v3.interceptor.ClassLoaderFilterInterceptor;
@Injectable
@Extension(value = "ClassLoaderFilterDefinition_v3")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED,
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnDubbo3GovernanceEnabled
@ConditionalOnClass(ClassLoaderFilterDefinition.TYPE_CLASSLOADER_FILTER)
-@ConditionalOnClass(ClassLoaderFilterDefinition.TYPE_CONSUMER_CLASSLOADER_FILTER)
public class ClassLoaderFilterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_CLASSLOADER_FILTER = "org.apache.dubbo.rpc.filter.ClassLoaderFilter";
- protected static final String TYPE_CONSUMER_CLASSLOADER_FILTER = "org.apache.dubbo.rpc.cluster.filter.support.ConsumerClassLoaderFilter";
-
private static final String METHOD_INVOKE = "invoke";
protected static final String[] ARGUMENT_INVOKE = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/ClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/ClusterDefinition.java
index 06be41291..b6b66046e 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/ClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/ClusterDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,16 +24,14 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v3.condition.ConditionalOnDubbo3FlowControlEnabled;
import com.jd.live.agent.plugin.router.dubbo.v3.interceptor.ClusterInterceptor;
@Injectable
-@Extension(value = "ClusterDefinition_v2.7")
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
+@Extension(value = "ClusterDefinition_v3")
+@ConditionalOnDubbo3FlowControlEnabled
@ConditionalOnClass(ClusterDefinition.TYPE_ABSTRACT_CLUSTER)
-@ConditionalOnClass(ClassLoaderFilterDefinition.TYPE_CONSUMER_CLASSLOADER_FILTER)
public class ClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_ABSTRACT_CLUSTER = "org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker";
diff --git a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/LoadBalanceDefinition.java b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/LoadBalanceDefinition.java
index 669ad21de..79189bd45 100644
--- a/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/LoadBalanceDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-dubbo3/src/main/java/com/jd/live/agent/plugin/router/dubbo/v3/definition/LoadBalanceDefinition.java
@@ -16,28 +16,21 @@
package com.jd.live.agent.plugin.router.dubbo.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.dubbo.v3.condition.ConditionalOnDubbo3OnlyRouteEnabled;
import com.jd.live.agent.plugin.router.dubbo.v3.interceptor.LoadBalanceInterceptor;
@Injectable
-@Extension(value = "LoadBalanceDefinition_v2.7")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, value = "false"),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_DUBBO_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@Extension(value = "LoadBalanceDefinition_v3")
+@ConditionalOnDubbo3OnlyRouteEnabled
@ConditionalOnClass(LoadBalanceDefinition.TYPE_ABSTRACT_CLUSTER)
-@ConditionalOnClass(ClassLoaderFilterDefinition.TYPE_CONSUMER_CLASSLOADER_FILTER)
public class LoadBalanceDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_ABSTRACT_CLUSTER = "com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker";
diff --git a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/condition/ConditionalOnGrpcEnabled.java b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/condition/ConditionalOnGrpcEnabled.java
new file mode 100644
index 000000000..577184e64
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/condition/ConditionalOnGrpcEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.gprc.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_GRPC_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnGrpcEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/condition/ConditionalOnGrpcGovernanceEnabled.java b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/condition/ConditionalOnGrpcGovernanceEnabled.java
new file mode 100644
index 000000000..0eaf7bd93
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/condition/ConditionalOnGrpcGovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.gprc.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnGovernanceEnabled
+@ConditionalOnGrpcEnabled
+@ConditionalComposite
+public @interface ConditionalOnGrpcGovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/ClientInterceptorsDefinition.java b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/ClientInterceptorsDefinition.java
index c6e7e8d3e..c6f8b9085 100644
--- a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/ClientInterceptorsDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/ClientInterceptorsDefinition.java
@@ -17,8 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
-import com.jd.live.agent.core.extension.annotation.ConditionalRelation;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -26,18 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.gprc.condition.ConditionalOnGrpcGovernanceEnabled;
import com.jd.live.agent.plugin.router.gprc.interceptor.ClientInterceptorsInterceptor;
@Injectable
@Extension(value = "ClientInterceptorsDefinition", order = PluginDefinition.ORDER_ROUTER)
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED,
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED
-}, matchIfMissing = true, relation = ConditionalRelation.OR)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_GRPC_ENABLED, matchIfMissing = true)
+@ConditionalOnGrpcGovernanceEnabled
@ConditionalOnClass(ClientInterceptorsDefinition.TYPE)
public class ClientInterceptorsDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/GrpcClientBeanDefinition.java b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/GrpcClientBeanDefinition.java
index 5746db1a9..5846ebc8f 100644
--- a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/GrpcClientBeanDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/GrpcClientBeanDefinition.java
@@ -17,23 +17,16 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
-import com.jd.live.agent.core.extension.annotation.ConditionalRelation;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.plugin.router.gprc.condition.ConditionalOnGrpcGovernanceEnabled;
import com.jd.live.agent.plugin.router.gprc.interceptor.GrpcClientBeanInterceptor;
@Extension(value = "GrpcClientBeanDefinition", order = PluginDefinition.ORDER_ROUTER)
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED,
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED
-}, matchIfMissing = true, relation = ConditionalRelation.OR)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_GRPC_ENABLED, matchIfMissing = true)
+@ConditionalOnGrpcGovernanceEnabled
@ConditionalOnClass(GrpcClientBeanDefinition.TYPE)
public class GrpcClientBeanDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/GrpcServerDefinition.java b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/GrpcServerDefinition.java
index 20bb712df..23f0f9226 100644
--- a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/GrpcServerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/GrpcServerDefinition.java
@@ -16,25 +16,21 @@
package com.jd.live.agent.plugin.router.gprc.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.gprc.condition.ConditionalOnGrpcGovernanceEnabled;
import com.jd.live.agent.plugin.router.gprc.interceptor.GrpcServerInterceptor;
@Injectable
@Extension(value = "GrpcServerDefinition", order = PluginDefinition.ORDER_ROUTER)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_GRPC_ENABLED, matchIfMissing = true)
+@ConditionalOnGrpcGovernanceEnabled
@ConditionalOnClass(GrpcServerDefinition.TYPE_SERVER_IMPL_BUILDER)
public class GrpcServerDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/LoadbalancerDefinition.java b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/LoadbalancerDefinition.java
index dc15d3ee9..65d4367b4 100644
--- a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/LoadbalancerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/LoadbalancerDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.router.gprc.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
@@ -24,17 +25,12 @@
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
import com.jd.live.agent.core.util.time.Timer;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.plugin.router.gprc.condition.ConditionalOnGrpcGovernanceEnabled;
import com.jd.live.agent.plugin.router.gprc.interceptor.LoadbalancerInterceptor;
@Injectable
@Extension(value = "LoadbalancerDefinition", order = PluginDefinition.ORDER_ROUTER)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_GRPC_ENABLED, matchIfMissing = true)
+@ConditionalOnGrpcGovernanceEnabled
@ConditionalOnClass(LoadbalancerDefinition.TYPE)
public class LoadbalancerDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/NameResolverDefinition.java b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/NameResolverDefinition.java
index f607dc927..9c38256c0 100644
--- a/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/NameResolverDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-grpc/src/main/java/com/jd/live/agent/plugin/router/gprc/definition/NameResolverDefinition.java
@@ -16,23 +16,19 @@
package com.jd.live.agent.plugin.router.gprc.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.plugin.router.gprc.condition.ConditionalOnGrpcGovernanceEnabled;
import com.jd.live.agent.plugin.router.gprc.interceptor.NameResolverInterceptor;
@Injectable
@Extension(value = "NameResolverDefinition", order = PluginDefinition.ORDER_ROUTER)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_GRPC_ENABLED, matchIfMissing = true)
+@ConditionalOnGrpcGovernanceEnabled
@ConditionalOnClass(NameResolverDefinition.TYPE)
public class NameResolverDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/condition/ConditionalOnKafkaAnyRouteEnabled.java b/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/condition/ConditionalOnKafkaAnyRouteEnabled.java
new file mode 100644
index 000000000..e8887e231
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/condition/ConditionalOnKafkaAnyRouteEnabled.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.kafka.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnMqEnabled;
+import com.jd.live.agent.governance.annotation.ConditionalOnOnlyRouteEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnOnlyRouteEnabled
+@ConditionalOnMqEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_KAFKA_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnKafkaAnyRouteEnabled {
+
+}
+
diff --git a/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/ConsumerConfigDefinition.java b/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/ConsumerConfigDefinition.java
index 5f815cea8..15004123f 100644
--- a/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/ConsumerConfigDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/ConsumerConfigDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.kafka.v3.condition.ConditionalOnKafkaAnyRouteEnabled;
import com.jd.live.agent.plugin.router.kafka.v3.interceptor.GroupInterceptor;
/**
@@ -35,11 +34,7 @@
*/
@Injectable
@Extension(value = "ConsumerConfigDefinition_v3")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_PULSAR_ENABLED)
+@ConditionalOnKafkaAnyRouteEnabled
@ConditionalOnClass(ConsumerConfigDefinition.TYPE_CONSUMER_CONFIG)
public class ConsumerConfigDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/FetchDefinition.java b/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/FetchDefinition.java
index a4f6574bd..ae8858d25 100644
--- a/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/FetchDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/FetchDefinition.java
@@ -17,16 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
-import com.jd.live.agent.core.extension.annotation.ConditionalRelation;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.kafka.v3.condition.ConditionalOnKafkaAnyRouteEnabled;
import com.jd.live.agent.plugin.router.kafka.v3.interceptor.FetchInterceptor;
/**
@@ -36,12 +34,7 @@
*/
@Injectable
@Extension(value = "FetchDefinition_v3")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, relation = ConditionalRelation.OR, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_PULSAR_ENABLED)
+@ConditionalOnKafkaAnyRouteEnabled
@ConditionalOnClass(FetchDefinition.TYPE_FETCH)
public class FetchDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/FetcherDefinition.java b/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/FetcherDefinition.java
index 6e658529f..677006a7e 100644
--- a/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/FetcherDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-kafka3/src/main/java/com/jd/live/agent/plugin/router/kafka/v3/definition/FetcherDefinition.java
@@ -17,16 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
-import com.jd.live.agent.core.extension.annotation.ConditionalRelation;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.kafka.v3.condition.ConditionalOnKafkaAnyRouteEnabled;
import com.jd.live.agent.plugin.router.kafka.v3.interceptor.FetcherInterceptor;
/**
@@ -36,12 +34,7 @@
*/
@Injectable
@Extension(value = "FetcherDefinition_v3")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, relation = ConditionalRelation.OR, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_PULSAR_ENABLED)
+@ConditionalOnKafkaAnyRouteEnabled
@ConditionalOnClass(FetcherDefinition.TYPE_FETCHER)
public class FetcherDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/condition/ConditionalOnRocketmq4AnyRouteEnabled.java b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/condition/ConditionalOnRocketmq4AnyRouteEnabled.java
new file mode 100644
index 000000000..d5a112197
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/condition/ConditionalOnRocketmq4AnyRouteEnabled.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.rocketmq.v4.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnMqEnabled;
+import com.jd.live.agent.governance.annotation.ConditionalOnOnlyRouteEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnOnlyRouteEnabled
+@ConditionalOnMqEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnClass(ConditionalOnRocketmq4AnyRouteEnabled.TYPE_CLIENT_LOGGER)
+@ConditionalComposite
+public @interface ConditionalOnRocketmq4AnyRouteEnabled {
+
+ String TYPE_CLIENT_LOGGER = "org.apache.rocketmq.client.log.ClientLogger";
+
+}
+
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/LitePullConsumerDefinition.java b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/LitePullConsumerDefinition.java
index cc8f47d8b..d66f99e92 100644
--- a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/LitePullConsumerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/LitePullConsumerDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.rocketmq.v4.condition.ConditionalOnRocketmq4AnyRouteEnabled;
import com.jd.live.agent.plugin.router.rocketmq.v4.interceptor.GroupInterceptor;
/**
@@ -35,14 +34,8 @@
*/
@Injectable
@Extension(value = "LitePullConsumerDefinition_v4")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnRocketmq4AnyRouteEnabled
@ConditionalOnClass(LitePullConsumerDefinition.TYPE_LITE_PULL_CONSUMER)
-@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_CLIENT_LOGGER)
public class LitePullConsumerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_LITE_PULL_CONSUMER = "org.apache.rocketmq.client.consumer.LitePullConsumer";
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/MQPullConsumerDefinition.java b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/MQPullConsumerDefinition.java
index 43720f3d9..495810c19 100644
--- a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/MQPullConsumerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/MQPullConsumerDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.rocketmq.v4.condition.ConditionalOnRocketmq4AnyRouteEnabled;
import com.jd.live.agent.plugin.router.rocketmq.v4.interceptor.GroupInterceptor;
/**
@@ -35,14 +34,8 @@
*/
@Injectable
@Extension(value = "MQPullConsumerDefinition_v4")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnRocketmq4AnyRouteEnabled
@ConditionalOnClass(MQPullConsumerDefinition.TYPE_MQ_PULL_CONSUMER)
-@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_CLIENT_LOGGER)
public class MQPullConsumerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_MQ_PULL_CONSUMER = "org.apache.rocketmq.client.consumer.MQPullConsumer";
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/MQPushConsumerDefinition.java b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/MQPushConsumerDefinition.java
index 2996b0ed5..f11c44306 100644
--- a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/MQPushConsumerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/MQPushConsumerDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.rocketmq.v4.condition.ConditionalOnRocketmq4AnyRouteEnabled;
import com.jd.live.agent.plugin.router.rocketmq.v4.interceptor.GroupInterceptor;
/**
@@ -35,14 +34,8 @@
*/
@Injectable
@Extension(value = "MQPushConsumerDefinition_v4")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnRocketmq4AnyRouteEnabled
@ConditionalOnClass(MQPushConsumerDefinition.TYPE_MQ_PUSH_CONSUMER)
-@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_CLIENT_LOGGER)
public class MQPushConsumerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_MQ_PUSH_CONSUMER = "org.apache.rocketmq.client.consumer.MQPushConsumer";
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/PullAPIWrapperDefinition.java b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/PullAPIWrapperDefinition.java
index f200f1800..d97f35387 100644
--- a/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/PullAPIWrapperDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq4/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v4/definition/PullAPIWrapperDefinition.java
@@ -17,16 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
-import com.jd.live.agent.core.extension.annotation.ConditionalRelation;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.rocketmq.v4.condition.ConditionalOnRocketmq4AnyRouteEnabled;
import com.jd.live.agent.plugin.router.rocketmq.v4.interceptor.PullInterceptor;
import com.jd.live.agent.plugin.router.rocketmq.v4.interceptor.RegisterFilterInterceptor;
@@ -37,20 +35,12 @@
*/
@Injectable
@Extension(value = "PullAPIWrapperDefinition_v4")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, relation = ConditionalRelation.OR, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnRocketmq4AnyRouteEnabled
@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_PULL_API_WRAPPER)
-@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_CLIENT_LOGGER)
public class PullAPIWrapperDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_PULL_API_WRAPPER = "org.apache.rocketmq.client.impl.consumer.PullAPIWrapper";
- protected static final String TYPE_CLIENT_LOGGER = "org.apache.rocketmq.client.log.ClientLogger";
-
private static final String METHOD_REGISTER_FILTER_MESSAGE_HOOK = "registerFilterMessageHook";
private static final String[] ARGUMENT_REGISTER_FILTER_MESSAGE_HOOK = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/condition/ConditionalOnRocketmq5AnyRouteEnabled.java b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/condition/ConditionalOnRocketmq5AnyRouteEnabled.java
new file mode 100644
index 000000000..f84448f12
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/condition/ConditionalOnRocketmq5AnyRouteEnabled.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.rocketmq.v5.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.annotation.ConditionalOnMqEnabled;
+import com.jd.live.agent.governance.annotation.ConditionalOnOnlyRouteEnabled;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnOnlyRouteEnabled
+@ConditionalOnMqEnabled
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnClass(ConditionalOnRocketmq5AnyRouteEnabled.TYPE_ACK_CALLBACK)
+@ConditionalComposite
+public @interface ConditionalOnRocketmq5AnyRouteEnabled {
+
+ String TYPE_ACK_CALLBACK = "org.apache.rocketmq.client.consumer.AckCallback";
+
+}
+
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/LitePullConsumerDefinition.java b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/LitePullConsumerDefinition.java
index 5d801abac..550e4cfca 100644
--- a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/LitePullConsumerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/LitePullConsumerDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.rocketmq.v5.condition.ConditionalOnRocketmq5AnyRouteEnabled;
import com.jd.live.agent.plugin.router.rocketmq.v5.interceptor.GroupInterceptor;
/**
@@ -35,14 +34,8 @@
*/
@Injectable
@Extension(value = "LitePullConsumerDefinition_v5")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnRocketmq5AnyRouteEnabled
@ConditionalOnClass(LitePullConsumerDefinition.TYPE_LITE_PULL_CONSUMER)
-@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_ACK_CALLBACK)
public class LitePullConsumerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_LITE_PULL_CONSUMER = "org.apache.rocketmq.client.consumer.LitePullConsumer";
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/MQPullConsumerDefinition.java b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/MQPullConsumerDefinition.java
index 97ba3d2c7..5254d6415 100644
--- a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/MQPullConsumerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/MQPullConsumerDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.rocketmq.v5.condition.ConditionalOnRocketmq5AnyRouteEnabled;
import com.jd.live.agent.plugin.router.rocketmq.v5.interceptor.GroupInterceptor;
/**
@@ -35,14 +34,8 @@
*/
@Injectable
@Extension(value = "MQPullConsumerDefinition_v5")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnRocketmq5AnyRouteEnabled
@ConditionalOnClass(MQPullConsumerDefinition.TYPE_MQ_PULL_CONSUMER)
-@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_ACK_CALLBACK)
public class MQPullConsumerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_MQ_PULL_CONSUMER = "org.apache.rocketmq.client.consumer.MQPullConsumer";
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/MQPushConsumerDefinition.java b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/MQPushConsumerDefinition.java
index 7735465ed..3c76a5a69 100644
--- a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/MQPushConsumerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/MQPushConsumerDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.rocketmq.v5.condition.ConditionalOnRocketmq5AnyRouteEnabled;
import com.jd.live.agent.plugin.router.rocketmq.v5.interceptor.GroupInterceptor;
/**
@@ -35,14 +34,8 @@
*/
@Injectable
@Extension(value = "MQPushConsumerDefinition_v5")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnRocketmq5AnyRouteEnabled
@ConditionalOnClass(MQPushConsumerDefinition.TYPE_MQ_PUSH_CONSUMER)
-@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_ACK_CALLBACK)
public class MQPushConsumerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_MQ_PUSH_CONSUMER = "org.apache.rocketmq.client.consumer.MQPushConsumer";
diff --git a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/PullAPIWrapperDefinition.java b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/PullAPIWrapperDefinition.java
index 4dda58296..6bdd2eb6a 100644
--- a/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/PullAPIWrapperDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-rocketmq5/src/main/java/com/jd/live/agent/plugin/router/rocketmq/v5/definition/PullAPIWrapperDefinition.java
@@ -17,16 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
-import com.jd.live.agent.core.extension.annotation.ConditionalRelation;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.rocketmq.v5.condition.ConditionalOnRocketmq5AnyRouteEnabled;
import com.jd.live.agent.plugin.router.rocketmq.v5.interceptor.PullInterceptor;
import com.jd.live.agent.plugin.router.rocketmq.v5.interceptor.RegisterFilterInterceptor;
@@ -37,20 +35,12 @@
*/
@Injectable
@Extension(value = "PullAPIWrapperDefinition_v5")
-@ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
-}, relation = ConditionalRelation.OR, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_MQ_ENABLED)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ROCKETMQ_ENABLED, matchIfMissing = true)
+@ConditionalOnRocketmq5AnyRouteEnabled
@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_PULL_API_WRAPPER)
-@ConditionalOnClass(PullAPIWrapperDefinition.TYPE_ACK_CALLBACK)
public class PullAPIWrapperDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_PULL_API_WRAPPER = "org.apache.rocketmq.client.impl.consumer.PullAPIWrapper";
- protected static final String TYPE_ACK_CALLBACK = "org.apache.rocketmq.client.consumer.AckCallback";
-
private static final String METHOD_REGISTER_FILTER_MESSAGE_HOOK = "registerFilterMessageHook";
private static final String[] ARGUMENT_REGISTER_FILTER_MESSAGE_HOOK = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcEnabled.java b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcEnabled.java
new file mode 100644
index 000000000..dce5c6b99
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.sofarpc.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
+import com.jd.live.agent.governance.config.GovernanceConfig;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SOFARPC_ENABLED, matchIfMissing = true)
+@ConditionalComposite
+public @interface ConditionalOnSofaRpcEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcFlowControlEnabled.java b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcFlowControlEnabled.java
new file mode 100644
index 000000000..1e32dea5b
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcFlowControlEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.sofarpc.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnFlowControlEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSofaRpcEnabled
+@ConditionalOnFlowControlEnabled
+@ConditionalComposite
+public @interface ConditionalOnSofaRpcFlowControlEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcGovernanceEnabled.java b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcGovernanceEnabled.java
new file mode 100644
index 000000000..0043557d6
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcGovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.sofarpc.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSofaRpcEnabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnSofaRpcGovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcOnlyRouteEnabled.java b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcOnlyRouteEnabled.java
new file mode 100644
index 000000000..70a5be8d4
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/condition/ConditionalOnSofaRpcOnlyRouteEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.sofarpc.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnOnlyRouteEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSofaRpcEnabled
+@ConditionalOnOnlyRouteEnabled
+@ConditionalComposite
+public @interface ConditionalOnSofaRpcOnlyRouteEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/ClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/ClusterDefinition.java
index cdde9769d..114ef8033 100644
--- a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/ClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/ClusterDefinition.java
@@ -17,7 +17,6 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,14 +24,13 @@
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.sofarpc.condition.ConditionalOnSofaRpcFlowControlEnabled;
import com.jd.live.agent.plugin.router.sofarpc.interceptor.ClusterInterceptor;
@Injectable
@Extension(value = "ClusterDefinition")
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SOFARPC_ENABLED, matchIfMissing = true)
+@ConditionalOnSofaRpcFlowControlEnabled
@ConditionalOnClass(ClusterDefinition.TYPE_ABSTRACT_CLUSTER)
public class ClusterDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/LoadBalanceDefinition.java b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/LoadBalanceDefinition.java
index 991795f8b..830cad824 100644
--- a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/LoadBalanceDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/LoadBalanceDefinition.java
@@ -16,27 +16,21 @@
package com.jd.live.agent.plugin.router.sofarpc.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.parser.ObjectParser;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.sofarpc.condition.ConditionalOnSofaRpcOnlyRouteEnabled;
import com.jd.live.agent.plugin.router.sofarpc.interceptor.LoadBalanceInterceptor;
@Injectable
@Extension(value = "LoadBalanceDefinition")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, value = "false"),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SOFARPC_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSofaRpcOnlyRouteEnabled
@ConditionalOnClass(LoadBalanceDefinition.TYPE_ABSTRACT_CLUSTER)
public class LoadBalanceDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/ProviderInvokerDefinition.java b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/ProviderInvokerDefinition.java
index 50e3cddc6..ff0e17ced 100644
--- a/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/ProviderInvokerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-sofarpc/src/main/java/com/jd/live/agent/plugin/router/sofarpc/definition/ProviderInvokerDefinition.java
@@ -16,26 +16,20 @@
package com.jd.live.agent.plugin.router.sofarpc.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.sofarpc.condition.ConditionalOnSofaRpcGovernanceEnabled;
import com.jd.live.agent.plugin.router.sofarpc.interceptor.ProviderInvokerInterceptor;
@Injectable
@Extension(value = "ProviderInvokerDefinition")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED,
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SOFARPC_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSofaRpcGovernanceEnabled
@ConditionalOnClass(ProviderInvokerDefinition.TYPE_PROVIDER_INVOKER)
public class ProviderInvokerDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/condition/ConditionalOnSpringCloud2Enabled.java b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/condition/ConditionalOnSpringCloud2Enabled.java
new file mode 100644
index 000000000..1b23229fb
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/condition/ConditionalOnSpringCloud2Enabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.springcloud.v2.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringEnabled
+@ConditionalOnMissingClass(ConditionalOnSpringCloud2Enabled.TYPE_STICKY_SESSION_SUPPLIER)
+@ConditionalComposite
+public @interface ConditionalOnSpringCloud2Enabled {
+
+ String TYPE_STICKY_SESSION_SUPPLIER = "org.springframework.cloud.loadbalancer.core.RequestBasedStickySessionServiceInstanceListSupplier";
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/condition/ConditionalOnSpringCloud2GovernanceEnabled.java b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/condition/ConditionalOnSpringCloud2GovernanceEnabled.java
new file mode 100644
index 000000000..11e29eb17
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/condition/ConditionalOnSpringCloud2GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.springcloud.v2.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringCloud2Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnSpringCloud2GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/BlockingClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/BlockingClusterDefinition.java
index ff9e86ef0..e19338170 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/BlockingClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/BlockingClusterDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.router.springcloud.v2.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v2.condition.ConditionalOnSpringCloud2GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v2.interceptor.BlockingClusterInterceptor;
/**
@@ -33,22 +34,12 @@
*/
@Injectable
@Extension(value = "BlockingClusterDefinition_v2")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED,
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSpringCloud2GovernanceEnabled
@ConditionalOnClass(BlockingClusterDefinition.TYPE_LOADBALANCER_INTERCEPTOR)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
public class BlockingClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_LOADBALANCER_INTERCEPTOR = "org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor";
- protected static final String TYPE_STICKY_SESSION_SUPPLIER = "org.springframework.cloud.loadbalancer.core.RequestBasedStickySessionServiceInstanceListSupplier";
-
private static final String METHOD_INTERCEPT = "intercept";
private static final String[] ARGUMENT_INTERCEPT = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/FeignClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/FeignClusterDefinition.java
index bddb641de..30b4894d5 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/FeignClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/FeignClusterDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.router.springcloud.v2.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v2.condition.ConditionalOnSpringCloud2GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v2.interceptor.FeignClusterInterceptor;
/**
@@ -33,16 +34,8 @@
*/
@Injectable
@Extension(value = "FeignClusterDefinition_v2")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED,
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSpringCloud2GovernanceEnabled
@ConditionalOnClass(FeignClusterDefinition.TYPE_FEIGN_BLOCKING_LOADBALANCER_CLIENT)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
public class FeignClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_FEIGN_BLOCKING_LOADBALANCER_CLIENT = "org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/FeignRibbonClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/FeignRibbonClusterDefinition.java
index ce5948351..5f6e58028 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/FeignRibbonClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/FeignRibbonClusterDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.router.springcloud.v2.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v2.condition.ConditionalOnSpringCloud2GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v2.interceptor.FeignClusterInterceptor;
/**
@@ -33,16 +34,8 @@
*/
@Injectable
@Extension(value = "FeignRibbonClusterDefinition_v2")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED,
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSpringCloud2GovernanceEnabled
@ConditionalOnClass(FeignRibbonClusterDefinition.TYPE_FEIGN_BLOCKING_LOADBALANCER_CLIENT)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
public class FeignRibbonClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_FEIGN_BLOCKING_LOADBALANCER_CLIENT = "org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/RetryableBlockingClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/RetryableBlockingClusterDefinition.java
index 0820f6849..59b011936 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/RetryableBlockingClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/RetryableBlockingClusterDefinition.java
@@ -17,16 +17,15 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringRetry;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v2.condition.ConditionalOnSpringCloud2GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v2.interceptor.BlockingClusterInterceptor;
/**
@@ -36,17 +35,13 @@
*/
@Injectable
@Extension(value = "BlockingRetryClusterDefinition_v2")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@ConditionalOnSpringCloud2GovernanceEnabled
+@ConditionalOnSpringRetry
@ConditionalOnClass(RetryableBlockingClusterDefinition.TYPE_RETRY_LOADBALANCER_INTERCEPTOR)
-@ConditionalOnClass(RetryableBlockingClusterDefinition.TYPE_RETRY_TEMPLATE)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
public class RetryableBlockingClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_RETRY_LOADBALANCER_INTERCEPTOR = "org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor";
- protected static final String TYPE_RETRY_TEMPLATE = "org.springframework.retry.support.RetryTemplate";
-
private static final String METHOD_INTERCEPT = "intercept";
private static final String[] ARGUMENT_INTERCEPT = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/RetryableFeignClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/RetryableFeignClusterDefinition.java
index 80eaa2865..a0cef094f 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/RetryableFeignClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/RetryableFeignClusterDefinition.java
@@ -16,14 +16,16 @@
package com.jd.live.agent.plugin.router.springcloud.v2.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringRetry;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v2.condition.ConditionalOnSpringCloud2GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v2.interceptor.FeignClusterInterceptor;
/**
@@ -33,23 +35,13 @@
*/
@Injectable
@Extension(value = "FeignRetryableClientDefinition_v2")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED,
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSpringCloud2GovernanceEnabled
+@ConditionalOnSpringRetry
@ConditionalOnClass(RetryableFeignClusterDefinition.TYPE_RETRYABLE_FEIGN_BLOCKING_LOADBALANCER_CLIENT)
-@ConditionalOnClass(RetryableFeignClusterDefinition.TYPE_RETRY_TEMPLATE)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
public class RetryableFeignClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_RETRYABLE_FEIGN_BLOCKING_LOADBALANCER_CLIENT = "org.springframework.cloud.openfeign.loadbalancer.RetryableFeignBlockingLoadBalancerClient";
- protected static final String TYPE_RETRY_TEMPLATE = "org.springframework.retry.support.RetryTemplate";
-
private static final String METHOD_EXECUTE = "execute";
private static final String[] ARGUMENT_FILTER = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/ServiceInstanceListSupplierDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/ServiceInstanceListSupplierDefinition.java
index af5a482e0..b58862ecc 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/ServiceInstanceListSupplierDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud2/src/main/java/com/jd/live/agent/plugin/router/springcloud/v2/definition/ServiceInstanceListSupplierDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.router.springcloud.v2.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Config;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,6 +26,7 @@
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v2.condition.ConditionalOnSpringCloud2GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v2.interceptor.ServiceInstanceListSupplierInterceptor;
import java.util.Set;
@@ -36,16 +38,8 @@
*/
@Injectable
@Extension(value = "ServiceInstanceListSupplierPluginDefinition_v2")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED,
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSpringCloud2GovernanceEnabled
@ConditionalOnClass(ServiceInstanceListSupplierDefinition.TYPE_SERVICE_INSTANCE_LIST_SUPPLIER)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
public class ServiceInstanceListSupplierDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_SERVICE_INSTANCE_LIST_SUPPLIER = "org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3Enabled.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3Enabled.java
new file mode 100644
index 000000000..8d9b5f440
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3Enabled.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.springcloud.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringEnabled
+@ConditionalOnClass(ConditionalOnSpringCloud3Enabled.TYPE_STICKY_SESSION_SUPPLIER)
+@ConditionalOnMissingClass(ConditionalOnSpringCloud3Enabled.TYPE_HTTP_STATUS_CODE)
+@ConditionalComposite
+public @interface ConditionalOnSpringCloud3Enabled {
+
+ String TYPE_STICKY_SESSION_SUPPLIER = "org.springframework.cloud.loadbalancer.core.RequestBasedStickySessionServiceInstanceListSupplier";
+
+ String TYPE_HTTP_STATUS_CODE = "org.springframework.http.HttpStatusCode";
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3FlowControlEnabled.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3FlowControlEnabled.java
new file mode 100644
index 000000000..3c6c15f87
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3FlowControlEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.springcloud.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnFlowControlEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringCloud3Enabled
+@ConditionalOnFlowControlEnabled
+@ConditionalComposite
+public @interface ConditionalOnSpringCloud3FlowControlEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3GovernanceEnabled.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3GovernanceEnabled.java
new file mode 100644
index 000000000..057f62e84
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/condition/ConditionalOnSpringCloud3GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.springcloud.v3.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringCloud3Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnSpringCloud3GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/BlockingClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/BlockingClusterDefinition.java
index c0338e0f4..19c378fe8 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/BlockingClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/BlockingClusterDefinition.java
@@ -17,16 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v3.condition.ConditionalOnSpringCloud3FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v3.interceptor.BlockingClusterInterceptor;
/**
@@ -36,19 +34,12 @@
*/
@Injectable
@Extension(value = "BlockingClusterDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@ConditionalOnSpringCloud3FlowControlEnabled
@ConditionalOnClass(BlockingClusterDefinition.TYPE_LOADBALANCER_INTERCEPTOR)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class BlockingClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_LOADBALANCER_INTERCEPTOR = "org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor";
- protected static final String TYPE_STICKY_SESSION_SUPPLIER = "org.springframework.cloud.loadbalancer.core.RequestBasedStickySessionServiceInstanceListSupplier";
-
- protected static final String TYPE_HTTP_STATUS_CODE = "org.springframework.http.HttpStatusCode";
-
private static final String METHOD_INTERCEPT = "intercept";
private static final String[] ARGUMENT_INTERCEPT = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/FeignClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/FeignClusterDefinition.java
index e765f1198..eb4cc80d0 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/FeignClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/FeignClusterDefinition.java
@@ -17,16 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v3.condition.ConditionalOnSpringCloud3FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v3.interceptor.FeignClusterInterceptor;
/**
@@ -36,11 +34,8 @@
*/
@Injectable
@Extension(value = "FeignClusterDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@ConditionalOnSpringCloud3FlowControlEnabled
@ConditionalOnClass(FeignClusterDefinition.TYPE_FEIGN_BLOCKING_LOADBALANCER_CLIENT)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class FeignClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_FEIGN_BLOCKING_LOADBALANCER_CLIENT = "org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ReactiveClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ReactiveClusterDefinition.java
index f9e6664ad..4425026e8 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ReactiveClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ReactiveClusterDefinition.java
@@ -17,31 +17,27 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnReactive;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v3.condition.ConditionalOnSpringCloud3FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v3.interceptor.ReactiveClusterInterceptor;
/**
- * ClientClusterDefinition
+ * ReactiveClusterDefinition
*
* @since 1.0.0
*/
@Injectable
@Extension(value = "ClientClusterDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@ConditionalOnSpringCloud3FlowControlEnabled
+@ConditionalOnReactive
@ConditionalOnClass(ReactiveClusterDefinition.TYPE_LOADBALANCED_EXCHANGE_FILTER_FUNCTION)
-@ConditionalOnClass(ReactiveClusterDefinition.REACTOR_MONO)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class ReactiveClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_LOADBALANCED_EXCHANGE_FILTER_FUNCTION = "org.springframework.cloud.client.loadbalancer.reactive.LoadBalancedExchangeFilterFunction";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ReactorLoadBalancerDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ReactorLoadBalancerDefinition.java
index c5cb5ee13..e472c9feb 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ReactorLoadBalancerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ReactorLoadBalancerDefinition.java
@@ -16,11 +16,13 @@
package com.jd.live.agent.plugin.router.springcloud.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnReactive;
+import com.jd.live.agent.plugin.router.springcloud.v3.condition.ConditionalOnSpringCloud3GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v3.interceptor.ReactorLoadBalancerInterceptor;
/**
@@ -29,18 +31,9 @@
* @since 1.0.0
*/
@Extension(value = "ReactorLoadBalancerDefinition_v3")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED,
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSpringCloud3GovernanceEnabled
+@ConditionalOnReactive
@ConditionalOnClass(ReactorLoadBalancerDefinition.TYPE_REACTOR_LOAD_BALANCER)
-@ConditionalOnClass(ReactiveClusterDefinition.REACTOR_MONO)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class ReactorLoadBalancerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_REACTOR_LOAD_BALANCER = "org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/RetryableBlockingClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/RetryableBlockingClusterDefinition.java
index a075ea939..6af91454a 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/RetryableBlockingClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/RetryableBlockingClusterDefinition.java
@@ -17,16 +17,15 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringRetry;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v3.condition.ConditionalOnSpringCloud3FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v3.interceptor.BlockingClusterInterceptor;
/**
@@ -36,18 +35,13 @@
*/
@Injectable
@Extension(value = "BlockingRetryClusterDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@ConditionalOnSpringCloud3FlowControlEnabled
+@ConditionalOnSpringRetry
@ConditionalOnClass(RetryableBlockingClusterDefinition.TYPE_RETRY_LOADBALANCER_INTERCEPTOR)
-@ConditionalOnClass(RetryableBlockingClusterDefinition.TYPE_RETRY_TEMPLATE)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class RetryableBlockingClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_RETRY_LOADBALANCER_INTERCEPTOR = "org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor";
- protected static final String TYPE_RETRY_TEMPLATE = "org.springframework.retry.support.RetryTemplate";
-
private static final String METHOD_INTERCEPT = "intercept";
private static final String[] ARGUMENT_INTERCEPT = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/RetryableFeignClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/RetryableFeignClusterDefinition.java
index ac8a78b7b..76b7b2b28 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/RetryableFeignClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/RetryableFeignClusterDefinition.java
@@ -17,16 +17,15 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnMissingClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringRetry;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v3.condition.ConditionalOnSpringCloud3FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v3.interceptor.FeignClusterInterceptor;
/**
@@ -36,18 +35,13 @@
*/
@Injectable
@Extension(value = "FeignRetryableClientDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@ConditionalOnSpringCloud3FlowControlEnabled
+@ConditionalOnSpringRetry
@ConditionalOnClass(RetryableFeignClusterDefinition.TYPE_RETRYABLE_FEIGN_BLOCKING_LOADBALANCER_CLIENT)
-@ConditionalOnClass(RetryableFeignClusterDefinition.TYPE_RETRY_TEMPLATE)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class RetryableFeignClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_RETRYABLE_FEIGN_BLOCKING_LOADBALANCER_CLIENT = "org.springframework.cloud.openfeign.loadbalancer.RetryableFeignBlockingLoadBalancerClient";
- protected static final String TYPE_RETRY_TEMPLATE = "org.springframework.retry.support.RetryTemplate";
-
private static final String METHOD_EXECUTE = "execute";
private static final String[] ARGUMENT_FILTER = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ServiceInstanceListSupplierDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ServiceInstanceListSupplierDefinition.java
index 0b29e8bab..d4ba8eead 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ServiceInstanceListSupplierDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud3/src/main/java/com/jd/live/agent/plugin/router/springcloud/v3/definition/ServiceInstanceListSupplierDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.router.springcloud.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Config;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,6 +26,7 @@
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v3.condition.ConditionalOnSpringCloud3GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v3.interceptor.ServiceInstanceListSupplierInterceptor;
import java.util.Set;
@@ -37,17 +39,8 @@
*/
@Injectable
@Extension(value = "ServiceInstanceListSupplierPluginDefinition_v3")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED,
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@ConditionalOnSpringCloud3GovernanceEnabled
@ConditionalOnClass(ServiceInstanceListSupplierDefinition.TYPE_SERVICE_INSTANCE_LIST_SUPPLIER)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_STICKY_SESSION_SUPPLIER)
-@ConditionalOnMissingClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class ServiceInstanceListSupplierDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_SERVICE_INSTANCE_LIST_SUPPLIER = "org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4Enabled.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4Enabled.java
new file mode 100644
index 000000000..a74dabdd2
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4Enabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.springcloud.v4.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringEnabled
+@ConditionalOnClass(ConditionalOnSpringCloud4Enabled.TYPE_HTTP_STATUS_CODE)
+@ConditionalComposite
+public @interface ConditionalOnSpringCloud4Enabled {
+
+ String TYPE_HTTP_STATUS_CODE = "org.springframework.http.HttpStatusCode";
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4FlowControlEnabled.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4FlowControlEnabled.java
new file mode 100644
index 000000000..18143fd45
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4FlowControlEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.springcloud.v4.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnFlowControlEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringCloud4Enabled
+@ConditionalOnFlowControlEnabled
+@ConditionalComposite
+public @interface ConditionalOnSpringCloud4FlowControlEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4GovernanceEnabled.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4GovernanceEnabled.java
new file mode 100644
index 000000000..7ee9e252d
--- /dev/null
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/condition/ConditionalOnSpringCloud4GovernanceEnabled.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.router.springcloud.v4.condition;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.governance.annotation.ConditionalOnGovernanceEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnSpringCloud4Enabled
+@ConditionalOnGovernanceEnabled
+@ConditionalComposite
+public @interface ConditionalOnSpringCloud4GovernanceEnabled {
+
+}
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/BlockingClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/BlockingClusterDefinition.java
index 39e40619b..ab4d6d735 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/BlockingClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/BlockingClusterDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v4.condition.ConditionalOnSpringCloud4FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v4.interceptor.BlockingClusterInterceptor;
/**
@@ -34,17 +33,13 @@
* @since 1.0.0
*/
@Injectable
-@Extension(value = "BlockingClusterDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@Extension(value = "BlockingClusterDefinition_v4")
+@ConditionalOnSpringCloud4FlowControlEnabled
@ConditionalOnClass(BlockingClusterDefinition.TYPE_LOADBALANCER_INTERCEPTOR)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class BlockingClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_LOADBALANCER_INTERCEPTOR = "org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor";
- protected static final String TYPE_HTTP_STATUS_CODE = "org.springframework.http.HttpStatusCode";
-
private static final String METHOD_INTERCEPT = "intercept";
private static final String[] ARGUMENT_INTERCEPT = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/FeignClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/FeignClusterDefinition.java
index b219c47be..8fe96ffe0 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/FeignClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/FeignClusterDefinition.java
@@ -17,15 +17,14 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v4.condition.ConditionalOnSpringCloud4FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v4.interceptor.FeignClusterInterceptor;
/**
@@ -34,11 +33,9 @@
* @since 1.0.0
*/
@Injectable
-@Extension(value = "FeignClusterDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@Extension(value = "FeignClusterDefinition_v4")
+@ConditionalOnSpringCloud4FlowControlEnabled
@ConditionalOnClass(FeignClusterDefinition.TYPE_FEIGN_BLOCKING_LOADBALANCER_CLIENT)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class FeignClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_FEIGN_BLOCKING_LOADBALANCER_CLIENT = "org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ReactiveClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ReactiveClusterDefinition.java
index 524682640..2ab38aa2f 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ReactiveClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ReactiveClusterDefinition.java
@@ -17,32 +17,30 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnReactive;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v4.condition.ConditionalOnSpringCloud4FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v4.interceptor.ReactiveClusterInterceptor;
/**
- * ClientClusterDefinition
+ * ReactiveClusterDefinition
*
* @since 1.0.0
*/
@Injectable
-@Extension(value = "ClientClusterDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-@ConditionalOnClass(ReactiveClusterDefinition.TYPE_LOADBALANCED_EXCHANGE_FILTER_FUNCTION)
-@ConditionalOnClass(ReactiveClusterDefinition.REACTOR_MONO)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
+@Extension(value = "ClientClusterDefinition_v4")
+@ConditionalOnSpringCloud4FlowControlEnabled
+@ConditionalOnReactive
+@ConditionalOnClass(ReactiveClusterDefinition.TYPE_LOADBALANCER_EXCHANGE_FILTER_FUNCTION)
public class ReactiveClusterDefinition extends PluginDefinitionAdapter {
- protected static final String TYPE_LOADBALANCED_EXCHANGE_FILTER_FUNCTION = "org.springframework.cloud.client.loadbalancer.reactive.LoadBalancedExchangeFilterFunction";
+ protected static final String TYPE_LOADBALANCER_EXCHANGE_FILTER_FUNCTION = "org.springframework.cloud.client.loadbalancer.reactive.LoadBalancedExchangeFilterFunction";
private static final String METHOD_FILTER = "filter";
@@ -51,13 +49,11 @@ public class ReactiveClusterDefinition extends PluginDefinitionAdapter {
"org.springframework.web.reactive.function.client.ExchangeFunction"
};
- protected static final String REACTOR_MONO = "reactor.core.publisher.Mono";
-
@Inject(InvocationContext.COMPONENT_INVOCATION_CONTEXT)
private InvocationContext context;
public ReactiveClusterDefinition() {
- this.matcher = () -> MatcherBuilder.isImplement(TYPE_LOADBALANCED_EXCHANGE_FILTER_FUNCTION);
+ this.matcher = () -> MatcherBuilder.isImplement(TYPE_LOADBALANCER_EXCHANGE_FILTER_FUNCTION);
this.interceptors = new InterceptorDefinition[]{
new InterceptorDefinitionAdapter(
MatcherBuilder.named(METHOD_FILTER).
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ReactorLoadBalancerDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ReactorLoadBalancerDefinition.java
index b7063466d..3a1483391 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ReactorLoadBalancerDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ReactorLoadBalancerDefinition.java
@@ -16,11 +16,13 @@
package com.jd.live.agent.plugin.router.springcloud.v4.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnReactive;
+import com.jd.live.agent.plugin.router.springcloud.v4.condition.ConditionalOnSpringCloud4GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v4.interceptor.ReactorLoadBalancerInterceptor;
/**
@@ -28,17 +30,10 @@
*
* @since 1.0.0
*/
-@Extension(value = "ReactorLoadBalancerDefinition_v3")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED,
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@Extension(value = "ReactorLoadBalancerDefinition_v4")
+@ConditionalOnSpringCloud4GovernanceEnabled
+@ConditionalOnReactive
@ConditionalOnClass(ReactorLoadBalancerDefinition.TYPE_REACTOR_LOAD_BALANCER)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class ReactorLoadBalancerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_REACTOR_LOAD_BALANCER = "org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/RetryableBlockingClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/RetryableBlockingClusterDefinition.java
index f1b6a4f70..f17bbd95f 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/RetryableBlockingClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/RetryableBlockingClusterDefinition.java
@@ -17,15 +17,15 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringRetry;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v4.condition.ConditionalOnSpringCloud4FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v4.interceptor.BlockingClusterInterceptor;
/**
@@ -34,18 +34,14 @@
* @since 1.0.0
*/
@Injectable
-@Extension(value = "BlockingRetryClusterDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@Extension(value = "BlockingRetryClusterDefinition_v4")
+@ConditionalOnSpringCloud4FlowControlEnabled
+@ConditionalOnSpringRetry
@ConditionalOnClass(RetryableBlockingClusterDefinition.TYPE_RETRY_LOADBALANCER_INTERCEPTOR)
-@ConditionalOnClass(RetryableBlockingClusterDefinition.TYPE_RETRY_TEMPLATE)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class RetryableBlockingClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_RETRY_LOADBALANCER_INTERCEPTOR = "org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor";
- protected static final String TYPE_RETRY_TEMPLATE = "org.springframework.retry.support.RetryTemplate";
-
private static final String METHOD_INTERCEPT = "intercept";
private static final String[] ARGUMENT_INTERCEPT = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/RetryableFeignClusterDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/RetryableFeignClusterDefinition.java
index 3769ddbf4..bd22a2fcb 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/RetryableFeignClusterDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/RetryableFeignClusterDefinition.java
@@ -17,35 +17,31 @@
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
-import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnSpringRetry;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v4.condition.ConditionalOnSpringCloud4FlowControlEnabled;
import com.jd.live.agent.plugin.router.springcloud.v4.interceptor.FeignClusterInterceptor;
/**
- * FeignRetryableClientDefinition
+ * RetryableFeignClusterDefinition
*
* @since 1.0.0
*/
@Injectable
@Extension(value = "FeignRetryableClientDefinition_v3")
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
+@ConditionalOnSpringCloud4FlowControlEnabled
+@ConditionalOnSpringRetry
@ConditionalOnClass(RetryableFeignClusterDefinition.TYPE_RETRYABLE_FEIGN_BLOCKING_LOADBALANCER_CLIENT)
-@ConditionalOnClass(RetryableFeignClusterDefinition.TYPE_RETRY_TEMPLATE)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class RetryableFeignClusterDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_RETRYABLE_FEIGN_BLOCKING_LOADBALANCER_CLIENT = "org.springframework.cloud.openfeign.loadbalancer.RetryableFeignBlockingLoadBalancerClient";
- protected static final String TYPE_RETRY_TEMPLATE = "org.springframework.retry.support.RetryTemplate";
-
private static final String METHOD_EXECUTE = "execute";
private static final String[] ARGUMENT_FILTER = new String[]{
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ServiceInstanceListSupplierDefinition.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ServiceInstanceListSupplierDefinition.java
index 87092d663..43b9443b3 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ServiceInstanceListSupplierDefinition.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/definition/ServiceInstanceListSupplierDefinition.java
@@ -16,7 +16,8 @@
package com.jd.live.agent.plugin.router.springcloud.v4.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Config;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
@@ -25,6 +26,7 @@
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
+import com.jd.live.agent.plugin.router.springcloud.v4.condition.ConditionalOnSpringCloud4GovernanceEnabled;
import com.jd.live.agent.plugin.router.springcloud.v4.interceptor.ServiceInstanceListSupplierInterceptor;
import java.util.Set;
@@ -36,17 +38,9 @@
* @since 1.0.0
*/
@Injectable
-@Extension(value = "ServiceInstanceListSupplierPluginDefinition_v3")
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(name = {
- GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED,
- GovernanceConfig.CONFIG_LIVE_ENABLED,
- GovernanceConfig.CONFIG_LANE_ENABLED
- }, matchIfMissing = true, relation = ConditionalRelation.OR),
- @ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SPRING_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.AND)
+@Extension(value = "ServiceInstanceListSupplierPluginDefinition_v4")
+@ConditionalOnSpringCloud4GovernanceEnabled
@ConditionalOnClass(ServiceInstanceListSupplierDefinition.TYPE_SERVICE_INSTANCE_LIST_SUPPLIER)
-@ConditionalOnClass(BlockingClusterDefinition.TYPE_HTTP_STATUS_CODE)
public class ServiceInstanceListSupplierDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_SERVICE_INSTANCE_LIST_SUPPLIER = "org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier";
diff --git a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/interceptor/ReactorLoadBalancerInterceptor.java b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/interceptor/ReactorLoadBalancerInterceptor.java
index 0dcbefa24..790f61213 100644
--- a/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/interceptor/ReactorLoadBalancerInterceptor.java
+++ b/joylive-plugin/joylive-router/joylive-router-springcloud4/src/main/java/com/jd/live/agent/plugin/router/springcloud/v4/interceptor/ReactorLoadBalancerInterceptor.java
@@ -18,8 +18,6 @@
import com.jd.live.agent.bootstrap.bytekit.context.ExecutableContext;
import com.jd.live.agent.core.plugin.definition.InterceptorAdaptor;
import com.jd.live.agent.core.util.cache.LazyObject;
-import com.jd.live.agent.core.util.type.ClassUtils;
-import com.jd.live.agent.core.util.type.FieldDesc;
import com.jd.live.agent.governance.context.RequestContext;
import com.jd.live.agent.governance.context.bag.Carrier;
import org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer;
@@ -27,6 +25,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import static com.jd.live.agent.core.util.type.ClassUtils.getValue;
+
/**
* ReactorLoadBalancerInterceptor
*
@@ -54,13 +54,6 @@ public void onEnter(ExecutableContext ctx) {
* an "empty" {@code LazyObject Annotations used: Annotations used:
- *
- *
- * @see PluginDefinitionAdapter
- * @see JavaHttpClientInterceptor
*/
@Extension(value = "JavaHttpClientDefinition", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(JavaHttpClientDefinition.TYPE_HTTP_REQUEST_BUILDER_IMPL)
public class JavaHttpClientDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-jdkhttp/src/main/java/com/jd/live/agent/plugin/transmission/jdkhttp/definition/SunHttpClientDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-jdkhttp/src/main/java/com/jd/live/agent/plugin/transmission/jdkhttp/definition/SunHttpClientDefinition.java
index dc2b805a1..453aca8da 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-jdkhttp/src/main/java/com/jd/live/agent/plugin/transmission/jdkhttp/definition/SunHttpClientDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-jdkhttp/src/main/java/com/jd/live/agent/plugin/transmission/jdkhttp/definition/SunHttpClientDefinition.java
@@ -16,12 +16,13 @@
package com.jd.live.agent.plugin.transmission.jdkhttp.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginImporter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.plugin.transmission.jdkhttp.interceptor.SunHttpClientInterceptor;
/**
@@ -30,26 +31,9 @@
* conditions under which the {@link SunHttpClientInterceptor} is applied, aiming
* to monitor or modify HTTP request writing behavior.
*
- *
- *
- *
- * @see PluginDefinitionAdapter
- * @see SunHttpClientInterceptor
*/
@Extension(value = "JdkHttpClientDefinition", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(SunHttpClientDefinition.TYPE_HTTP_CLIENT)
public class SunHttpClientDefinition extends PluginDefinitionAdapter implements PluginImporter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-kafka3/src/main/java/com/jd/live/agent/plugin/transmission/kafka/v3/definition/KafkaConsumerRecordDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-kafka3/src/main/java/com/jd/live/agent/plugin/transmission/kafka/v3/definition/KafkaConsumerRecordDefinition.java
index 8fa47dadc..a339194a3 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-kafka3/src/main/java/com/jd/live/agent/plugin/transmission/kafka/v3/definition/KafkaConsumerRecordDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-kafka3/src/main/java/com/jd/live/agent/plugin/transmission/kafka/v3/definition/KafkaConsumerRecordDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.transmission.kafka.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.governance.context.bag.CargoRequire;
import com.jd.live.agent.plugin.transmission.kafka.v3.interceptor.KafkaConsumerRecordInterceptor;
@@ -31,11 +32,7 @@
@Injectable
@Extension(value = "KafkaConsumerRecordDefinition_v3", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(KafkaConsumerRecordDefinition.TYPE_CONSUMER_RECORD)
public class KafkaConsumerRecordDefinition extends PluginDefinitionAdapter {
public static final String TYPE_CONSUMER_RECORD = "org.apache.kafka.clients.consumer.ConsumerRecord";
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-kafka3/src/main/java/com/jd/live/agent/plugin/transmission/kafka/v3/definition/KafkaProducerDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-kafka3/src/main/java/com/jd/live/agent/plugin/transmission/kafka/v3/definition/KafkaProducerDefinition.java
index 300d7f9f5..e0d794768 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-kafka3/src/main/java/com/jd/live/agent/plugin/transmission/kafka/v3/definition/KafkaProducerDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-kafka3/src/main/java/com/jd/live/agent/plugin/transmission/kafka/v3/definition/KafkaProducerDefinition.java
@@ -16,19 +16,16 @@
package com.jd.live.agent.plugin.transmission.kafka.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.plugin.transmission.kafka.v3.interceptor.KafkaProducerInterceptor;
@Extension(value = "KafkaProducerDefinition_v3", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(KafkaProducerDefinition.TYPE_KAFKA_PRODUCER)
public class KafkaProducerDefinition extends PluginDefinitionAdapter {
public static final String TYPE_KAFKA_PRODUCER = "org.apache.kafka.clients.producer.KafkaProducer";
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-nettyhttp1/src/main/java/com/jd/live/agent/plugin/transimission/nettyhttp/v1/definition/NettyHttpClientDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-nettyhttp1/src/main/java/com/jd/live/agent/plugin/transimission/nettyhttp/v1/definition/NettyHttpClientDefinition.java
index eee700a31..0bbafde5a 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-nettyhttp1/src/main/java/com/jd/live/agent/plugin/transimission/nettyhttp/v1/definition/NettyHttpClientDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-nettyhttp1/src/main/java/com/jd/live/agent/plugin/transimission/nettyhttp/v1/definition/NettyHttpClientDefinition.java
@@ -16,19 +16,16 @@
package com.jd.live.agent.plugin.transimission.nettyhttp.v1.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.plugin.transimission.nettyhttp.v1.interceptor.NettyHttpClientInterceptor;
@Extension(value = "NettyHttpClientDefinition_v1", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(NettyHttpClientDefinition.TYPE_HTTP_CLIENT)
@Deprecated
public class NettyHttpClientDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-okhttp1/src/main/java/com/jd/live/agent/plugin/transmission/okhttp/v1/definition/OkHttpClientDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-okhttp1/src/main/java/com/jd/live/agent/plugin/transmission/okhttp/v1/definition/OkHttpClientDefinition.java
index b6997b356..50140a0a7 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-okhttp1/src/main/java/com/jd/live/agent/plugin/transmission/okhttp/v1/definition/OkHttpClientDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-okhttp1/src/main/java/com/jd/live/agent/plugin/transmission/okhttp/v1/definition/OkHttpClientDefinition.java
@@ -16,19 +16,16 @@
package com.jd.live.agent.plugin.transmission.okhttp.v1.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.plugin.transmission.okhttp.v1.interceptor.OkHttpClientInterceptor;
@Extension(value = "OkHttpClientDefinition_v1", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(OkHttpClientDefinition.TYPE_REQUEST_BUILDER)
public class OkHttpClientDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-okhttp3/src/main/java/com/jd/live/agent/plugin/transmission/okhttp/v3/definition/OkHttpClientDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-okhttp3/src/main/java/com/jd/live/agent/plugin/transmission/okhttp/v3/definition/OkHttpClientDefinition.java
index 943890a51..9e850eafd 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-okhttp3/src/main/java/com/jd/live/agent/plugin/transmission/okhttp/v3/definition/OkHttpClientDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-okhttp3/src/main/java/com/jd/live/agent/plugin/transmission/okhttp/v3/definition/OkHttpClientDefinition.java
@@ -16,19 +16,16 @@
package com.jd.live.agent.plugin.transmission.okhttp.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.plugin.transmission.okhttp.v3.interceptor.OkHttpClientInterceptor;
@Extension(value = "OkHttpClientDefinition_v3", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(OkHttpClientDefinition.TYPE_OK_HTTPCLIENT)
public class OkHttpClientDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-pulsar3/src/main/java/com/jd/live/agent/plugin/transmission/pulsar/v3/definition/MessageBuilderDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-pulsar3/src/main/java/com/jd/live/agent/plugin/transmission/pulsar/v3/definition/MessageBuilderDefinition.java
index 31bdee4b9..d25bf6904 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-pulsar3/src/main/java/com/jd/live/agent/plugin/transmission/pulsar/v3/definition/MessageBuilderDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-pulsar3/src/main/java/com/jd/live/agent/plugin/transmission/pulsar/v3/definition/MessageBuilderDefinition.java
@@ -16,19 +16,16 @@
package com.jd.live.agent.plugin.transmission.pulsar.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.plugin.transmission.pulsar.v3.interceptor.SendInterceptor;
@Extension(value = "MessageBuilderDefinition_v3", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(MessageBuilderDefinition.TYPE_TYPED_MESSAGE_BUILDER)
public class MessageBuilderDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-pulsar3/src/main/java/com/jd/live/agent/plugin/transmission/pulsar/v3/definition/MessageDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-pulsar3/src/main/java/com/jd/live/agent/plugin/transmission/pulsar/v3/definition/MessageDefinition.java
index 0742044ba..08706b2f8 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-pulsar3/src/main/java/com/jd/live/agent/plugin/transmission/pulsar/v3/definition/MessageDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-pulsar3/src/main/java/com/jd/live/agent/plugin/transmission/pulsar/v3/definition/MessageDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.transmission.pulsar.v3.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.governance.context.bag.CargoRequire;
import com.jd.live.agent.plugin.transmission.pulsar.v3.interceptor.MessageInterceptor;
@@ -31,11 +32,7 @@
@Injectable
@Extension(value = "MessageDefinition_v3", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(MessageDefinition.TYPE_MESSAGE)
public class MessageDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/ChannelNDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/ChannelNDefinition.java
index 0f2b1bcda..386cdc787 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/ChannelNDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/ChannelNDefinition.java
@@ -16,19 +16,16 @@
package com.jd.live.agent.plugin.transmission.rabbitmq.v5.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.plugin.transmission.rabbitmq.v5.interceptor.PublishInterceptor;
@Extension(value = "ChannelNDefinition_v5", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(ChannelNDefinition.TYPE_CHANNEL_N)
public class ChannelNDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/ConsumerDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/ConsumerDefinition.java
index f039a7b4a..d1bf60905 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/ConsumerDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/ConsumerDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.transmission.rabbitmq.v5.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.governance.context.bag.CargoRequire;
import com.jd.live.agent.plugin.transmission.rabbitmq.v5.interceptor.HandleInterceptor;
@@ -31,11 +32,7 @@
@Injectable
@Extension(value = "ConsumerDefinition_v5", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(ConsumerDefinition.TYPE_CONSUMER)
public class ConsumerDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/DeliveryDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/DeliveryDefinition.java
index 635f7f70a..e170ca653 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/DeliveryDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-rabbitmq5/src/main/java/com/jd/live/agent/plugin/transmission/rabbitmq/v5/definition/DeliveryDefinition.java
@@ -16,14 +16,15 @@
package com.jd.live.agent.plugin.transmission.rabbitmq.v5.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
import com.jd.live.agent.governance.context.bag.CargoRequire;
import com.jd.live.agent.plugin.transmission.rabbitmq.v5.interceptor.GetBodyInterceptor;
@@ -31,11 +32,7 @@
@Injectable
@Extension(value = "DeliveryDefinition_v5", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnTransmissionEnabled
@ConditionalOnClass(DeliveryDefinition.TYPE_MESSAGE)
public class DeliveryDefinition extends PluginDefinitionAdapter {
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/contidion/ConditionalOnRocketmq4TransmissionEnabled.java b/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/contidion/ConditionalOnRocketmq4TransmissionEnabled.java
new file mode 100644
index 000000000..dd359293a
--- /dev/null
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/contidion/ConditionalOnRocketmq4TransmissionEnabled.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright © ${year} ${owner} (${email})
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jd.live.agent.plugin.transmission.rocketmq.v4.contidion;
+
+import com.jd.live.agent.core.extension.annotation.ConditionalComposite;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.governance.annotation.ConditionalOnTransmissionEnabled;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@ConditionalOnTransmissionEnabled
+@ConditionalOnClass(ConditionalOnRocketmq4TransmissionEnabled.TYPE_CLIENT_LOGGER)
+@ConditionalComposite
+public @interface ConditionalOnRocketmq4TransmissionEnabled {
+
+ String TYPE_CLIENT_LOGGER = "org.apache.rocketmq.client.log.ClientLogger";
+}
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/definition/MQProducerDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/definition/MQProducerDefinition.java
index 0a67e6474..4cf6298d7 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/definition/MQProducerDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/definition/MQProducerDefinition.java
@@ -16,21 +16,17 @@
package com.jd.live.agent.plugin.transmission.rocketmq.v4.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
+import com.jd.live.agent.plugin.transmission.rocketmq.v4.contidion.ConditionalOnRocketmq4TransmissionEnabled;
import com.jd.live.agent.plugin.transmission.rocketmq.v4.interceptor.MQProducerInterceptor;
@Extension(value = "MQProducerDefinition_v4", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnRocketmq4TransmissionEnabled
@ConditionalOnClass(MQProducerDefinition.TYPE_MQ_PRODUCER)
-@ConditionalOnClass(MessageDefinition.TYPE_CLIENT_LOGGER)
public class MQProducerDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_MQ_PRODUCER = "org.apache.rocketmq.client.producer.MQProducer";
diff --git a/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/definition/MessageDefinition.java b/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/definition/MessageDefinition.java
index bc3ba762f..284f7113c 100644
--- a/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/definition/MessageDefinition.java
+++ b/joylive-plugin/joylive-transmission/joylive-transmission-rocketmq4/src/main/java/com/jd/live/agent/plugin/transmission/rocketmq/v4/definition/MessageDefinition.java
@@ -16,36 +16,30 @@
package com.jd.live.agent.plugin.transmission.rocketmq.v4.definition;
import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
-import com.jd.live.agent.core.extension.annotation.*;
+import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
+import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinition;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
-import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.context.bag.CargoRequire;
+import com.jd.live.agent.plugin.transmission.rocketmq.v4.contidion.ConditionalOnRocketmq4TransmissionEnabled;
import com.jd.live.agent.plugin.transmission.rocketmq.v4.interceptor.MessageInterceptor;
import java.util.List;
@Injectable
@Extension(value = "MessageDefinition_v4", order = PluginDefinition.ORDER_TRANSMISSION)
-@ConditionalOnProperties(value = {
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_LANE_ENABLED, matchIfMissing = true),
- @ConditionalOnProperty(value = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
-}, relation = ConditionalRelation.OR)
+@ConditionalOnRocketmq4TransmissionEnabled
@ConditionalOnClass(MessageDefinition.TYPE_MESSAGE)
-@ConditionalOnClass(MessageDefinition.TYPE_CLIENT_LOGGER)
public class MessageDefinition extends PluginDefinitionAdapter {
protected static final String TYPE_MESSAGE = "org.apache.rocketmq.common.message.Message";
private static final String METHOD_GET_BODY = "getBody";
- public static final String TYPE_CLIENT_LOGGER = "org.apache.rocketmq.client.log.ClientLogger";
-
@Inject
private List