From 50c12f685d8542565deec6ee9b1280311ae534b7 Mon Sep 17 00:00:00 2001 From: wangyu096 Date: Sat, 7 Oct 2023 17:01:31 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20Job=20=E5=88=87=E6=8D=A2=20GSE2.0=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=81=B0=E5=BA=A6=E7=AD=96=E7=95=A5=20#2461?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommonServiceAutoConfiguration.java | 38 +++++++++++++++++++ .../service/ConfigRefreshEventListener.java | 4 -- .../main/resources/META-INF/spring.factories | 3 +- 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/CommonServiceAutoConfiguration.java diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/CommonServiceAutoConfiguration.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/CommonServiceAutoConfiguration.java new file mode 100644 index 0000000000..f3efebc360 --- /dev/null +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/CommonServiceAutoConfiguration.java @@ -0,0 +1,38 @@ +/* + * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. + * + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. + * + * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. + * + * License for BK-JOB蓝鲸智云作业平台: + * -------------------------------------------------------------------- + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of + * the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +package com.tencent.bk.job.common.service; + +import com.tencent.bk.job.common.util.feature.FeatureStore; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration(proxyBeanMethods = false) +public class CommonServiceAutoConfiguration { + + @Bean + public ConfigRefreshEventListener configRefreshEventListener(FeatureStore featureStore) { + return new ConfigRefreshEventListener(featureStore); + } +} diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/ConfigRefreshEventListener.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/ConfigRefreshEventListener.java index 9f6cbc17c8..ea4ce0639f 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/ConfigRefreshEventListener.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/ConfigRefreshEventListener.java @@ -27,10 +27,8 @@ import com.tencent.bk.job.common.util.feature.FeatureStore; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.context.environment.EnvironmentChangeEvent; import org.springframework.context.event.EventListener; -import org.springframework.stereotype.Component; import java.util.Set; import java.util.StringJoiner; @@ -38,13 +36,11 @@ /** * 配置刷新监听 */ -@Component @Slf4j public class ConfigRefreshEventListener { private final FeatureStore featureStore; - @Autowired public ConfigRefreshEventListener(FeatureStore featureStore) { this.featureStore = featureStore; log.info("Init ConfigRefreshEventListener"); diff --git a/src/backend/commons/common-service/src/main/resources/META-INF/spring.factories b/src/backend/commons/common-service/src/main/resources/META-INF/spring.factories index f8c5fa3817..561b2c1a74 100644 --- a/src/backend/commons/common-service/src/main/resources/META-INF/spring.factories +++ b/src/backend/commons/common-service/src/main/resources/META-INF/spring.factories @@ -2,4 +2,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.tencent.bk.job.common.service.lb.JobLoadBalancerClientAutoConfiguration, \ com.tencent.bk.job.common.service.deploy.DeployAutoConfiguration, \ -com.tencent.bk.job.common.service.feature.FeatureToggleAutoConfiguration +com.tencent.bk.job.common.service.feature.FeatureToggleAutoConfiguration, \ +com.tencent.bk.job.common.service.CommonServiceAutoConfiguration