From 3f03537bf16576d2f4d3157c311b251181edae20 Mon Sep 17 00:00:00 2001 From: shedfreewu Date: Wed, 20 Nov 2024 20:00:54 +0800 Subject: [PATCH] rm detector --- .../PolarisConfigAutoConfiguration.java | 12 -- .../adapter/PolarisConfigFileLocator.java | 2 +- ...sConfigRefreshScopeAnnotationDetector.java | 94 ------------- ...arisConfigRefreshOptimizationListener.java | 130 ------------------ .../adapter/PolarisConfigFileLocatorTest.java | 9 -- ...figRefreshScopeAnnotationDetectorTest.java | 99 ------------- .../RefreshScopeSpringProcessorTest.java | 3 + 7 files changed, 4 insertions(+), 345 deletions(-) delete mode 100644 spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigRefreshScopeAnnotationDetector.java delete mode 100644 spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigRefreshOptimizationListener.java delete mode 100644 spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigRefreshScopeAnnotationDetectorTest.java diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/PolarisConfigAutoConfiguration.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/PolarisConfigAutoConfiguration.java index 5604d9f04..8e266fe96 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/PolarisConfigAutoConfiguration.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/PolarisConfigAutoConfiguration.java @@ -20,14 +20,12 @@ import com.tencent.cloud.polaris.config.adapter.AffectedConfigurationPropertiesRebinder; import com.tencent.cloud.polaris.config.adapter.PolarisConfigPropertyRefresher; -import com.tencent.cloud.polaris.config.adapter.PolarisConfigRefreshScopeAnnotationDetector; import com.tencent.cloud.polaris.config.adapter.PolarisRefreshAffectedContextRefresher; import com.tencent.cloud.polaris.config.adapter.PolarisRefreshEntireContextRefresher; import com.tencent.cloud.polaris.config.annotation.PolarisConfigAnnotationProcessor; import com.tencent.cloud.polaris.config.condition.ConditionalOnReflectRefreshType; import com.tencent.cloud.polaris.config.config.PolarisConfigProperties; import com.tencent.cloud.polaris.config.listener.PolarisConfigChangeEventListener; -import com.tencent.cloud.polaris.config.listener.PolarisConfigRefreshOptimizationListener; import com.tencent.cloud.polaris.config.logger.PolarisConfigLoggerApplicationListener; import com.tencent.cloud.polaris.config.spring.annotation.SpringValueProcessor; import com.tencent.cloud.polaris.config.spring.property.PlaceholderHelper; @@ -112,15 +110,5 @@ public PolarisConfigPropertyRefresher polarisReflectPropertySourceAutoRefresher( return new PolarisRefreshAffectedContextRefresher(polarisConfigProperties, springValueRegistry, placeholderHelper, configFileService, contextRefresher); } - - @Bean - public PolarisConfigRefreshScopeAnnotationDetector polarisConfigRefreshScopeAnnotationDetector() { - return new PolarisConfigRefreshScopeAnnotationDetector(); - } - - @Bean - public PolarisConfigRefreshOptimizationListener polarisConfigRefreshOptimizationListener() { - return new PolarisConfigRefreshOptimizationListener(); - } } } diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java index 1063b23df..c4a25a06d 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java @@ -69,7 +69,7 @@ public class PolarisConfigFileLocator implements PropertySourceLocator { // this class provides customized logic for some customers to configure special business group files private final PolarisConfigCustomExtensionLayer polarisConfigCustomExtensionLayer = PolarisServiceLoaderUtil.getPolarisConfigCustomExtensionLayer(); - private volatile static CompositePropertySource compositePropertySourceCache = null; + private volatile CompositePropertySource compositePropertySourceCache = null; public PolarisConfigFileLocator(PolarisConfigProperties polarisConfigProperties, PolarisContextProperties polarisContextProperties, ConfigFileService configFileService, Environment environment) { diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigRefreshScopeAnnotationDetector.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigRefreshScopeAnnotationDetector.java deleted file mode 100644 index 5c26342ce..000000000 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigRefreshScopeAnnotationDetector.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making Spring Cloud Tencent available. - * - * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the BSD 3-Clause License (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://opensource.org/licenses/BSD-3-Clause - * - * 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.tencent.cloud.polaris.config.adapter; - -import java.lang.annotation.Annotation; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.core.Ordered; -import org.springframework.core.PriorityOrdered; -import org.springframework.lang.NonNull; - -/** - * Mainly used to detect whether the annotation class {@link org.springframework.cloud.context.config.annotation.RefreshScope} - * exists, and whether the user has configured beans using this annotation in their business system. - * If the annotation {@code @RefreshScope} exists and is used, the auto-optimization will be triggered - * in listener {@link com.tencent.cloud.polaris.config.listener.PolarisConfigRefreshOptimizationListener}. - * - *

This bean will only be created and initialized when the config refresh type is {@code RefreshType.REFLECT}. - * - * @author jarvisxiong - */ -@SuppressWarnings({"unchecked", "rawtypes"}) -public class PolarisConfigRefreshScopeAnnotationDetector implements BeanPostProcessor, InitializingBean, PriorityOrdered { - - private final AtomicBoolean isRefreshScopeAnnotationUsed = new AtomicBoolean(false); - - private Class refreshScopeAnnotationClass; - - private String annotatedRefreshScopeBeanName; - - @Override - public Object postProcessBeforeInitialization(@NonNull Object bean, @NonNull String beanName) - throws BeansException { - return bean; - } - - @Override - public Object postProcessAfterInitialization(@NonNull Object bean, @NonNull String beanName) - throws BeansException { - if (isRefreshScopeAnnotationUsed() || refreshScopeAnnotationClass == null) { - return bean; - } - Annotation[] refreshScopeAnnotations = bean.getClass().getAnnotationsByType(refreshScopeAnnotationClass); - if (refreshScopeAnnotations.length > 0) { - if (isRefreshScopeAnnotationUsed.compareAndSet(false, true)) { - annotatedRefreshScopeBeanName = beanName; - } - } - return bean; - } - - @Override - public void afterPropertiesSet() { - try { - refreshScopeAnnotationClass = Class.forName( - "org.springframework.cloud.context.config.annotation.RefreshScope", - false, - getClass().getClassLoader()); - } - catch (ClassNotFoundException ignored) { - } - } - - @Override - public int getOrder() { - return Ordered.LOWEST_PRECEDENCE; - } - - public boolean isRefreshScopeAnnotationUsed() { - return isRefreshScopeAnnotationUsed.get(); - } - - public String getAnnotatedRefreshScopeBeanName() { - return annotatedRefreshScopeBeanName; - } -} diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigRefreshOptimizationListener.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigRefreshOptimizationListener.java deleted file mode 100644 index 864bee027..000000000 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigRefreshOptimizationListener.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making Spring Cloud Tencent available. - * - * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the BSD 3-Clause License (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://opensource.org/licenses/BSD-3-Clause - * - * 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.tencent.cloud.polaris.config.listener; - -import java.util.Collections; - -import com.tencent.cloud.polaris.config.adapter.PolarisConfigRefreshScopeAnnotationDetector; -import com.tencent.cloud.polaris.config.adapter.PolarisRefreshEntireContextRefresher; -import com.tencent.cloud.polaris.config.config.PolarisConfigProperties; -import com.tencent.cloud.polaris.config.enums.RefreshType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.ConstructorArgumentValues; -import org.springframework.beans.factory.support.AbstractBeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.cloud.context.refresh.ContextRefresher; -import org.springframework.context.ApplicationListener; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.core.env.MapPropertySource; -import org.springframework.core.env.MutablePropertySources; -import org.springframework.lang.NonNull; - -import static com.tencent.cloud.polaris.config.condition.ReflectRefreshTypeCondition.POLARIS_CONFIG_REFRESH_TYPE; - -/** - * When {@link PolarisConfigRefreshScopeAnnotationDetector} detects that - * the annotation {@code @RefreshScope} exists and is used, but the config refresh type - * {@code spring.cloud.polaris.config.refresh-type} is still {@code RefreshType.REFLECT}, then the framework will - * automatically switch the config refresh type to {@code RefreshType.REFRESH_CONTEXT}. - * - *

The purpose of this optimization is to omit additional configuration, and facilitate for users to use the - * dynamic configuration refresh strategy of Spring Cloud Context.

- * - * @author jarvisxiong - */ -public class PolarisConfigRefreshOptimizationListener implements ApplicationListener { - - private static final Logger LOGGER = LoggerFactory.getLogger(PolarisConfigRefreshOptimizationListener.class); - - private static final String CONFIG_REFRESH_TYPE_PROPERTY = "configRefreshTypeProperty"; - - private static final String REFLECT_REBINDER_BEAN_NAME = "affectedConfigurationPropertiesRebinder"; - - private static final String REFLECT_REFRESHER_BEAN_NAME = "polarisReflectPropertySourceAutoRefresher"; - - private static final String REFRESH_CONTEXT_REFRESHER_BEAN_NAME = "polarisRefreshContextPropertySourceAutoRefresher"; - - - @Override - public void onApplicationEvent(@NonNull ContextRefreshedEvent event) { - ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) event.getApplicationContext(); - // using System.setProperty to set spring.cloud.polaris.config.refresh-type - String value = System.getProperty("spring.cloud.polaris.config.refresh-type"); - boolean isSystemSetRefreshType = RefreshType.REFRESH_CONTEXT.toString().equalsIgnoreCase(value); - // a bean is using @RefreshScope, but the config refresh type is still [reflect], switch automatically - if (isSystemSetRefreshType) { - if (isSystemSetRefreshType) { - LOGGER.warn("Detected that using System.setProperty to set spring.cloud.polaris.config.refresh-type = refresh_context, but the config refresh type is still [reflect]. " + "[SCT] will automatically switch to [refresh_context]."); - } - switchConfigRefreshTypeProperty(applicationContext); - modifyPolarisConfigPropertiesBean(applicationContext); - // remove related bean of type [reflect] - removeRelatedBeansOfReflect(applicationContext); - // register a new refresher bean of type [refresh_context] - registerRefresherBeanOfRefreshContext(applicationContext); - // add the new refresher to context as a listener - addRefresherBeanAsListener(applicationContext); - } - } - - private void switchConfigRefreshTypeProperty(ConfigurableApplicationContext applicationContext) { - MutablePropertySources propertySources = applicationContext.getEnvironment().getPropertySources(); - propertySources.addFirst(new MapPropertySource(CONFIG_REFRESH_TYPE_PROPERTY, Collections.singletonMap(POLARIS_CONFIG_REFRESH_TYPE, RefreshType.REFRESH_CONTEXT))); - } - - private void modifyPolarisConfigPropertiesBean(ConfigurableApplicationContext applicationContext) { - PolarisConfigProperties polarisConfigProperties = applicationContext.getBean(PolarisConfigProperties.class); - polarisConfigProperties.setRefreshType(RefreshType.REFRESH_CONTEXT); - } - - private void removeRelatedBeansOfReflect(ConfigurableApplicationContext applicationContext) { - try { - DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) applicationContext.getBeanFactory(); - beanFactory.removeBeanDefinition(REFLECT_REFRESHER_BEAN_NAME); - beanFactory.removeBeanDefinition(REFLECT_REBINDER_BEAN_NAME); - } - catch (BeansException e) { - // If there is a removeBean exception in this code, do not affect the main process startup. Some user usage may cause the polarisReflectPropertySourceAutoRefresher to not load, and the removeBeanDefinition will report an error - LOGGER.debug("removeRelatedBeansOfReflect occur error:", e); - } - } - - private void registerRefresherBeanOfRefreshContext(ConfigurableApplicationContext applicationContext) { - DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) applicationContext.getBeanFactory(); - AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition().getBeanDefinition(); - beanDefinition.setBeanClass(PolarisRefreshEntireContextRefresher.class); - PolarisConfigProperties polarisConfigProperties = beanFactory.getBean(PolarisConfigProperties.class); - ContextRefresher contextRefresher = beanFactory.getBean(ContextRefresher.class); - ConstructorArgumentValues constructorArgumentValues = beanDefinition.getConstructorArgumentValues(); - constructorArgumentValues.addIndexedArgumentValue(0, polarisConfigProperties); - constructorArgumentValues.addIndexedArgumentValue(1, contextRefresher); - beanFactory.registerBeanDefinition(REFRESH_CONTEXT_REFRESHER_BEAN_NAME, beanDefinition); - } - - - private void addRefresherBeanAsListener(ConfigurableApplicationContext applicationContext) { - PolarisRefreshEntireContextRefresher refresher = (PolarisRefreshEntireContextRefresher) applicationContext.getBean(REFRESH_CONTEXT_REFRESHER_BEAN_NAME); - applicationContext.addApplicationListener(refresher); - } -} diff --git a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocatorTest.java b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocatorTest.java index e41985bcf..5d25b2067 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocatorTest.java +++ b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocatorTest.java @@ -19,7 +19,6 @@ package com.tencent.cloud.polaris.config.adapter; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -42,7 +41,6 @@ import org.springframework.core.env.PropertySource; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.when; /** @@ -261,12 +259,5 @@ public void testGetCustomGroupFiles() { assertThat(propertySource.getProperty("k1")).isEqualTo("v1"); assertThat(propertySource.getProperty("k2")).isEqualTo("v2"); assertThat(propertySource.getProperty("k3")).isEqualTo("v3"); - - // parse error format - ConfigKVFile file3 = new MockedConfigKVFile(file1Map, "file3.txt"); - revisableConfigFileGroup = new RevisableConfigFileGroup(testNamespace, customGroup, Collections.singletonList(file3), "v1"); - when(configFileService.getConfigFileGroup(testNamespace, customGroup)).thenReturn(revisableConfigFileGroup); - assertThatThrownBy(() -> locator.locate(environment)).hasMessageContaining("Only configuration files in the format"); } - } diff --git a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigRefreshScopeAnnotationDetectorTest.java b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigRefreshScopeAnnotationDetectorTest.java deleted file mode 100644 index 485e1d086..000000000 --- a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigRefreshScopeAnnotationDetectorTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making Spring Cloud Tencent available. - * - * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the BSD 3-Clause License (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://opensource.org/licenses/BSD-3-Clause - * - * 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.tencent.cloud.polaris.config.adapter; - -import com.tencent.cloud.polaris.config.PolarisConfigAutoConfiguration; -import com.tencent.cloud.polaris.config.PolarisConfigBootstrapAutoConfiguration; -import org.assertj.core.api.InstanceOfAssertFactories; -import org.junit.jupiter.api.Test; - -import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration; -import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration; -import org.springframework.cloud.context.config.annotation.RefreshScope; - -import static org.assertj.core.api.Assertions.as; -import static org.assertj.core.api.Assertions.assertThat; - -/** - * test for {@link PolarisConfigRefreshScopeAnnotationDetector}. - */ -@SuppressWarnings("rawtypes") -public class PolarisConfigRefreshScopeAnnotationDetectorTest { - - private static Class refreshScopeAnnotationClass = null; - - static { - try { - refreshScopeAnnotationClass = Class.forName( - "org.springframework.cloud.context.config.annotation.RefreshScope", - false, - PolarisConfigRefreshScopeAnnotationDetectorTest.class.getClassLoader()); - } - catch (ClassNotFoundException ignored) { - } - } - - @Test - public void testUseRefreshScope() { - ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(PolarisConfigBootstrapAutoConfiguration.class)) - .withConfiguration(AutoConfigurations.of(PolarisConfigAutoConfiguration.class)) - .withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class)) - .withConfiguration(AutoConfigurations.of(ConfigurationPropertiesRebinderAutoConfiguration.class)) - .withBean("testBeanWithRefreshScope", TestBeanWithRefreshScope.class) - .withPropertyValues("spring.application.name=" + "polarisConfigRefreshScopeAnnotationDetectorTest") - .withPropertyValues("server.port=" + 8080) - .withPropertyValues("spring.cloud.polaris.address=grpc://127.0.0.1:10081"); - contextRunner.run(context -> { - assertThat(context).hasSingleBean(PolarisConfigRefreshScopeAnnotationDetector.class); - PolarisConfigRefreshScopeAnnotationDetector detector = context.getBean(PolarisConfigRefreshScopeAnnotationDetector.class); - assertThat(detector.isRefreshScopeAnnotationUsed()).isTrue(); - assertThat(detector.getAnnotatedRefreshScopeBeanName()).isEqualTo("scopedTarget.testBeanWithRefreshScope"); - assertThat(detector).extracting("refreshScopeAnnotationClass", as(InstanceOfAssertFactories.type(Class.class))) - .isEqualTo(refreshScopeAnnotationClass); - }); - } - - @Test - public void testNotUseRefreshScope() { - ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(PolarisConfigBootstrapAutoConfiguration.class)) - .withConfiguration(AutoConfigurations.of(PolarisConfigAutoConfiguration.class)) - .withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class)) - .withConfiguration(AutoConfigurations.of(ConfigurationPropertiesRebinderAutoConfiguration.class)) - .withPropertyValues("spring.application.name=" + "polarisConfigRefreshScopeAnnotationDetectorTest") - .withPropertyValues("server.port=" + 8080) - .withPropertyValues("spring.cloud.polaris.address=grpc://127.0.0.1:10081"); - contextRunner.run(context -> { - assertThat(context).hasSingleBean(PolarisConfigRefreshScopeAnnotationDetector.class); - PolarisConfigRefreshScopeAnnotationDetector detector = context.getBean(PolarisConfigRefreshScopeAnnotationDetector.class); - assertThat(detector.isRefreshScopeAnnotationUsed()).isFalse(); - assertThat(detector.getAnnotatedRefreshScopeBeanName()).isNull(); - assertThat(detector).extracting("refreshScopeAnnotationClass", as(InstanceOfAssertFactories.type(Class.class))) - .isEqualTo(refreshScopeAnnotationClass); - }); - } - - @RefreshScope - protected static class TestBeanWithRefreshScope { - - } -} diff --git a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/spring/annotation/RefreshScopeSpringProcessorTest.java b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/spring/annotation/RefreshScopeSpringProcessorTest.java index 7d1c9fbfd..9cdbb6284 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/spring/annotation/RefreshScopeSpringProcessorTest.java +++ b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/spring/annotation/RefreshScopeSpringProcessorTest.java @@ -151,6 +151,9 @@ public void setBeanFactory(BeanFactory beanFactory) { @RefreshScope private static class ValueTest { + public ValueTest() { + } + private static String name; @Value("${timeout:1000}") private int timeout;