diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java similarity index 100% rename from dubbo-compatible/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java rename to dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/annotation/Service.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java similarity index 100% rename from dubbo-compatible/src/main/java/com/alibaba/dubbo/config/annotation/Service.java rename to dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml index 04a8223bcb7..405b29e3230 100644 --- a/dubbo-config/dubbo-config-spring/pom.xml +++ b/dubbo-config/dubbo-config-spring/pom.xml @@ -128,5 +128,6 @@ tomcat-embed-core test + diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java index 2dec2d32b0a..0edc5f333ba 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java @@ -43,15 +43,15 @@ import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.annotation.ClassPathBeanDefinitionScanner; import org.springframework.context.annotation.ConfigurationClassPostProcessor; +import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.env.Environment; import org.springframework.core.io.ResourceLoader; import org.springframework.core.type.filter.AnnotationTypeFilter; -import org.springframework.util.Assert; -import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; +import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; @@ -61,10 +61,12 @@ import java.util.Set; import static org.apache.dubbo.config.spring.beans.factory.annotation.ServiceBeanNameBuilder.create; +import static org.apache.dubbo.config.spring.util.AnnotationUtils.resolveServiceInterfaceClass; import static org.apache.dubbo.config.spring.util.ObjectUtils.of; import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition; import static org.springframework.context.annotation.AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR; import static org.springframework.core.annotation.AnnotationUtils.findAnnotation; +import static org.springframework.core.annotation.AnnotationUtils.getAnnotationAttributes; import static org.springframework.util.ClassUtils.resolveClassName; /** @@ -132,6 +134,14 @@ private void registerServiceBeans(Set packagesToScan, BeanDefinitionRegi scanner.addIncludeFilter(new AnnotationTypeFilter(Service.class)); + /** + * Add the compatibility for legacy Dubbo's @Service + * + * The issue : https://github.com/apache/dubbo/issues/4330 + * @since 2.7.3 + */ + scanner.addIncludeFilter(new AnnotationTypeFilter(com.alibaba.dubbo.config.annotation.Service.class)); + for (String packageToScan : packagesToScan) { // Registers @Service Bean first @@ -250,17 +260,22 @@ private void registerServiceBean(BeanDefinitionHolder beanDefinitionHolder, Bean Class beanClass = resolveClass(beanDefinitionHolder); - Service service = findAnnotation(beanClass, Service.class); + Annotation service = findServiceAnnotation(beanClass); - Class interfaceClass = resolveServiceInterfaceClass(beanClass, service); + /** + * The {@link AnnotationAttributes} of @Service annotation + */ + AnnotationAttributes serviceAnnotationAttributes = getAnnotationAttributes(service, false, false); + + Class interfaceClass = resolveServiceInterfaceClass(serviceAnnotationAttributes, beanClass); String annotatedServiceBeanName = beanDefinitionHolder.getBeanName(); AbstractBeanDefinition serviceBeanDefinition = - buildServiceBeanDefinition(service, interfaceClass, annotatedServiceBeanName); + buildServiceBeanDefinition(service, serviceAnnotationAttributes, interfaceClass, annotatedServiceBeanName); // ServiceBean Bean name - String beanName = generateServiceBeanName(service, interfaceClass); + String beanName = generateServiceBeanName(serviceAnnotationAttributes, interfaceClass); if (scanner.checkCandidate(beanName, serviceBeanDefinition)) { // check duplicated candidate bean registry.registerBeanDefinition(beanName, serviceBeanDefinition); @@ -282,58 +297,37 @@ private void registerServiceBean(BeanDefinitionHolder beanDefinitionHolder, Bean } + + /** + * Find the {@link Annotation annotation} of @Service + * + * @param beanClass the {@link Class class} of Bean + * @return null if not found + * @since 2.7.3 + */ + private Annotation findServiceAnnotation(Class beanClass) { + Annotation service = findAnnotation(beanClass, Service.class); + if (service == null) { + service = findAnnotation(beanClass, com.alibaba.dubbo.config.annotation.Service.class); + } + return service; + } + /** * Generates the bean name of {@link ServiceBean} * - * @param service - * @param interfaceClass the class of interface annotated {@link Service} + * @param serviceAnnotationAttributes + * @param interfaceClass the class of interface annotated {@link Service} * @return ServiceBean@interfaceClassName#annotatedServiceBeanName - * @since 2.5.9 + * @since 2.7.3 */ - private String generateServiceBeanName(Service service, Class interfaceClass) { - ServiceBeanNameBuilder builder = create(service, interfaceClass, environment); - + private String generateServiceBeanName(AnnotationAttributes serviceAnnotationAttributes, Class interfaceClass) { + ServiceBeanNameBuilder builder = create(interfaceClass, environment) + .group(serviceAnnotationAttributes.getString("group")) + .version(serviceAnnotationAttributes.getString("version")); return builder.build(); } - private Class resolveServiceInterfaceClass(Class annotatedServiceBeanClass, Service service) { - - Class interfaceClass = service.interfaceClass(); - - if (void.class.equals(interfaceClass)) { - - interfaceClass = null; - - String interfaceClassName = service.interfaceName(); - - if (StringUtils.hasText(interfaceClassName)) { - if (ClassUtils.isPresent(interfaceClassName, classLoader)) { - interfaceClass = resolveClassName(interfaceClassName, classLoader); - } - } - - } - - if (interfaceClass == null) { - // Find all interfaces from the annotated class - // To resolve an issue : https://github.com/apache/dubbo/issues/3251 - Class[] allInterfaces = ClassUtils.getAllInterfacesForClass(annotatedServiceBeanClass); - - if (allInterfaces.length > 0) { - interfaceClass = allInterfaces[0]; - } - - } - - Assert.notNull(interfaceClass, - "@Service interfaceClass() or interfaceName() or interface class must be present!"); - - Assert.isTrue(interfaceClass.isInterface(), - "The type that was annotated @Service is not an interface!"); - - return interfaceClass; - } - private Class resolveClass(BeanDefinitionHolder beanDefinitionHolder) { BeanDefinition beanDefinition = beanDefinitionHolder.getBeanDefinition(); @@ -361,7 +355,19 @@ private Set resolvePackagesToScan(Set packagesToScan) { return resolvedPackagesToScan; } - private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class interfaceClass, + /** + * Build the {@link AbstractBeanDefinition Bean Definition} + * + * @param serviceAnnotation + * @param serviceAnnotationAttributes + * @param interfaceClass + * @param annotatedServiceBeanName + * @return + * @since 2.7.3 + */ + private AbstractBeanDefinition buildServiceBeanDefinition(Annotation serviceAnnotation, + AnnotationAttributes serviceAnnotationAttributes, + Class interfaceClass, String annotatedServiceBeanName) { BeanDefinitionBuilder builder = rootBeanDefinition(ServiceBean.class); @@ -373,19 +379,19 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class String[] ignoreAttributeNames = of("provider", "monitor", "application", "module", "registry", "protocol", "interface", "interfaceName", "parameters"); - propertyValues.addPropertyValues(new AnnotationPropertyValuesAdapter(service, environment, ignoreAttributeNames)); + propertyValues.addPropertyValues(new AnnotationPropertyValuesAdapter(serviceAnnotation, environment, ignoreAttributeNames)); // References "ref" property to annotated-@Service Bean addPropertyReference(builder, "ref", annotatedServiceBeanName); // Set interface builder.addPropertyValue("interface", interfaceClass.getName()); // Convert parameters into map - builder.addPropertyValue("parameters", convertParameters(service.parameters())); + builder.addPropertyValue("parameters", convertParameters(serviceAnnotationAttributes.getStringArray("parameters"))); /** * Add {@link org.apache.dubbo.config.ProviderConfig} Bean reference */ - String providerConfigBeanName = service.provider(); + String providerConfigBeanName = serviceAnnotationAttributes.getString("provider"); if (StringUtils.hasText(providerConfigBeanName)) { addPropertyReference(builder, "provider", providerConfigBeanName); } @@ -393,7 +399,7 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class /** * Add {@link org.apache.dubbo.config.MonitorConfig} Bean reference */ - String monitorConfigBeanName = service.monitor(); + String monitorConfigBeanName = serviceAnnotationAttributes.getString("monitor"); if (StringUtils.hasText(monitorConfigBeanName)) { addPropertyReference(builder, "monitor", monitorConfigBeanName); } @@ -401,7 +407,7 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class /** * Add {@link org.apache.dubbo.config.ApplicationConfig} Bean reference */ - String applicationConfigBeanName = service.application(); + String applicationConfigBeanName = serviceAnnotationAttributes.getString("application"); if (StringUtils.hasText(applicationConfigBeanName)) { addPropertyReference(builder, "application", applicationConfigBeanName); } @@ -409,7 +415,7 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class /** * Add {@link org.apache.dubbo.config.ModuleConfig} Bean reference */ - String moduleConfigBeanName = service.module(); + String moduleConfigBeanName = serviceAnnotationAttributes.getString("module"); if (StringUtils.hasText(moduleConfigBeanName)) { addPropertyReference(builder, "module", moduleConfigBeanName); } @@ -418,7 +424,7 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class /** * Add {@link org.apache.dubbo.config.RegistryConfig} Bean reference */ - String[] registryConfigBeanNames = service.registry(); + String[] registryConfigBeanNames = serviceAnnotationAttributes.getStringArray("registry"); List registryRuntimeBeanReferences = toRuntimeBeanReferences(registryConfigBeanNames); @@ -429,7 +435,7 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class /** * Add {@link org.apache.dubbo.config.ProtocolConfig} Bean reference */ - String[] protocolConfigBeanNames = service.protocol(); + String[] protocolConfigBeanNames = serviceAnnotationAttributes.getStringArray("protocol"); List protocolRuntimeBeanReferences = toRuntimeBeanReferences(protocolConfigBeanNames); diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceBeanNameBuilder.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceBeanNameBuilder.java index 5d272515ab3..390e0b6cf1f 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceBeanNameBuilder.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceBeanNameBuilder.java @@ -21,10 +21,12 @@ import org.apache.dubbo.config.spring.ReferenceBean; import org.apache.dubbo.config.spring.ServiceBean; +import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.env.Environment; import org.springframework.util.StringUtils; import static org.apache.dubbo.config.spring.util.AnnotationUtils.resolveInterfaceName; +import static org.springframework.core.annotation.AnnotationUtils.getAnnotationAttributes; /** * Dubbo {@link Service @Service} Bean Builder @@ -39,6 +41,7 @@ public class ServiceBeanNameBuilder { private static final String SEPARATOR = ":"; + // Required private final String interfaceClassName; private final Environment environment; @@ -48,25 +51,30 @@ public class ServiceBeanNameBuilder { private String group; + private ServiceBeanNameBuilder(Class interfaceClass, Environment environment) { + this(interfaceClass.getName(), environment); + } + private ServiceBeanNameBuilder(String interfaceClassName, Environment environment) { this.interfaceClassName = interfaceClassName; this.environment = environment; } - private ServiceBeanNameBuilder(Class interfaceClass, Environment environment) { - this(interfaceClass.getName(), environment); - } - - private ServiceBeanNameBuilder(Service service, Class interfaceClass, Environment environment) { - this(resolveInterfaceName(service, interfaceClass), environment); - this.group(service.group()); - this.version(service.version()); + private ServiceBeanNameBuilder(AnnotationAttributes attributes, Class defaultInterfaceClass, Environment environment) { + this(resolveInterfaceName(attributes, defaultInterfaceClass), environment); + this.group(attributes.getString("group")); + this.version(attributes.getString("version")); } - private ServiceBeanNameBuilder(Reference reference, Class interfaceClass, Environment environment) { - this(resolveInterfaceName(reference, interfaceClass), environment); - this.group(reference.group()); - this.version(reference.version()); + /** + * @param attributes + * @param defaultInterfaceClass + * @param environment + * @return + * @since 2.7.3 + */ + public static ServiceBeanNameBuilder create(AnnotationAttributes attributes, Class defaultInterfaceClass, Environment environment) { + return new ServiceBeanNameBuilder(attributes, defaultInterfaceClass, environment); } public static ServiceBeanNameBuilder create(Class interfaceClass, Environment environment) { @@ -74,16 +82,16 @@ public static ServiceBeanNameBuilder create(Class interfaceClass, Environment } public static ServiceBeanNameBuilder create(Service service, Class interfaceClass, Environment environment) { - return new ServiceBeanNameBuilder(service, interfaceClass, environment); + return create(getAnnotationAttributes(service, false, false), interfaceClass, environment); } public static ServiceBeanNameBuilder create(Reference reference, Class interfaceClass, Environment environment) { - return new ServiceBeanNameBuilder(reference, interfaceClass, environment); + return create(getAnnotationAttributes(reference, false, false), interfaceClass, environment); } private static void append(StringBuilder builder, String value) { if (StringUtils.hasText(value)) { - builder.append(value).append(SEPARATOR); + builder.append(SEPARATOR).append(value); } } @@ -98,14 +106,14 @@ public ServiceBeanNameBuilder version(String version) { } public String build() { - StringBuilder beanNameBuilder = new StringBuilder("ServiceBean").append(SEPARATOR); + StringBuilder beanNameBuilder = new StringBuilder("ServiceBean"); // Required append(beanNameBuilder, interfaceClassName); // Optional append(beanNameBuilder, version); append(beanNameBuilder, group); // Build and remove last ":" - String rawBeanName = beanNameBuilder.substring(0, beanNameBuilder.length() - 1); + String rawBeanName = beanNameBuilder.toString(); // Resolve placeholders return environment.resolvePlaceholders(rawBeanName); } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java index 9832e105624..600c1b72280 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java @@ -19,9 +19,11 @@ import org.apache.dubbo.config.annotation.Reference; import org.apache.dubbo.config.annotation.Service; +import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.env.Environment; import org.springframework.core.env.PropertyResolver; -import org.springframework.util.StringUtils; +import org.springframework.util.Assert; +import org.springframework.util.ClassUtils; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; @@ -41,8 +43,11 @@ import static org.springframework.core.annotation.AnnotationUtils.findAnnotation; import static org.springframework.core.annotation.AnnotationUtils.getAnnotationAttributes; import static org.springframework.core.annotation.AnnotationUtils.getDefaultValue; +import static org.springframework.util.ClassUtils.getAllInterfacesForClass; +import static org.springframework.util.ClassUtils.resolveClassName; import static org.springframework.util.CollectionUtils.arrayToList; import static org.springframework.util.ObjectUtils.nullSafeEquals; +import static org.springframework.util.StringUtils.hasText; import static org.springframework.util.StringUtils.trimWhitespace; /** @@ -53,11 +58,13 @@ */ public class AnnotationUtils { + + @Deprecated public static String resolveInterfaceName(Service service, Class defaultInterfaceClass) throws IllegalStateException { String interfaceName; - if (StringUtils.hasText(service.interfaceName())) { + if (hasText(service.interfaceName())) { interfaceName = service.interfaceName(); } else if (!void.class.equals(service.interfaceClass())) { interfaceName = service.interfaceClass().getName(); @@ -73,6 +80,85 @@ public static String resolveInterfaceName(Service service, Class defaultInter } + /** + * Resolve the interface name from {@link AnnotationAttributes} + * + * @param attributes {@link AnnotationAttributes} instance, may be {@link Service @Service} or {@link Reference @Reference} + * @param defaultInterfaceClass the default {@link Class class} of interface + * @return the interface name if found + * @throws IllegalStateException if interface name was not found + */ + public static String resolveInterfaceName(AnnotationAttributes attributes, Class defaultInterfaceClass) { + + String interfaceName = null; + + Class interfaceClass = attributes.getClass("interfaceClass"); + if (interfaceClass != null && !void.class.equals(interfaceClass)) { + interfaceName = interfaceClass.getName(); + } else if ((!hasText(interfaceName = attributes.getString("interfaceName")))) { + interfaceName = defaultInterfaceClass.isInterface() ? defaultInterfaceClass.getName() : null; + } + + if (!hasText(interfaceName)) { + throw new IllegalStateException( + "The @Service undefined interfaceClass or interfaceName, and the type " + + defaultInterfaceClass.getName() + " is not a interface."); + } + + return interfaceName; + } + + /** + * Resolve the {@link Class class} of Dubbo Service interface from the specified + * {@link AnnotationAttributes annotation attributes} and annotated {@link Class class}. + * + * @param attributes {@link AnnotationAttributes annotation attributes} + * @param annotatedClass the annotated {@link Class class}. + * @return the {@link Class class} of Dubbo Service interface + * @throws IllegalArgumentException if can't resolved + */ + public static Class resolveServiceInterfaceClass(AnnotationAttributes attributes, Class annotatedClass) + throws IllegalArgumentException { + + ClassLoader classLoader = annotatedClass.getClassLoader(); + + Class interfaceClass = attributes.getClass("interfaceClass"); + + if (void.class.equals(interfaceClass)) { // default or set void.class for purpose. + + interfaceClass = null; + + String interfaceClassName = attributes.getString("interfaceName"); + + if (hasText(interfaceClassName)) { + if (ClassUtils.isPresent(interfaceClassName, classLoader)) { + interfaceClass = resolveClassName(interfaceClassName, classLoader); + } + } + + } + + if (interfaceClass == null) { + // Find all interfaces from the annotated class + // To resolve an issue : https://github.com/apache/dubbo/issues/3251 + Class[] allInterfaces = getAllInterfacesForClass(annotatedClass); + + if (allInterfaces.length > 0) { + interfaceClass = allInterfaces[0]; + } + + } + + Assert.notNull(interfaceClass, + "@Service interfaceClass() or interfaceName() or interface class must be present!"); + + Assert.isTrue(interfaceClass.isInterface(), + "The type that was annotated @Service is not an interface!"); + + return interfaceClass; + } + + @Deprecated public static String resolveInterfaceName(Reference reference, Class defaultInterfaceClass) throws IllegalStateException { @@ -262,10 +348,10 @@ public static Map getAttributes(Annotation annotation, PropertyR * @since 2.7.1 * ignore annotation member */ - if (attributeValue.getClass().isAnnotation()){ + if (attributeValue.getClass().isAnnotation()) { continue; } - if (attributeValue.getClass().isArray() && attributeValue.getClass().getComponentType().isAnnotation()){ + if (attributeValue.getClass().isArray() && attributeValue.getClass().getComponentType().isAnnotation()) { continue; } diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java index 982e52a3f73..0044ea8c350 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java @@ -16,9 +16,10 @@ */ package org.apache.dubbo.config.spring.context.annotation.provider; -import org.apache.dubbo.config.annotation.Service; import org.apache.dubbo.config.spring.api.HelloService; +import com.alibaba.dubbo.config.annotation.Service; + /** * {@link HelloService} Implementation just annotating Dubbo's {@link Service} * diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/context/annotation/provider/ProviderConfiguration.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/context/annotation/provider/ProviderConfiguration.java index c77322848d6..9c45d7134a5 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/context/annotation/provider/ProviderConfiguration.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/context/annotation/provider/ProviderConfiguration.java @@ -22,6 +22,7 @@ import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.PropertySource; import org.springframework.transaction.PlatformTransactionManager; @@ -30,7 +31,8 @@ import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.EnableTransactionManagement; -@DubboComponentScan(basePackages = "org.apache.dubbo.config.spring.context.annotation.provider") +@DubboComponentScan(basePackages = "org.apache.dubbo") +@ComponentScan(basePackages = "org.apache.dubbo") @PropertySource("META-INF/default.properties") @EnableTransactionManagement public class ProviderConfiguration { diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index 20c17b66317..cdbe2bcd5d9 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -128,7 +128,7 @@ 3.0.19.Final 8.5.31 0.3.0 - 1.0.0 + 1.0.1 1.7.25 1.2 diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistryFactory.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistryFactory.java index 2b66fb1e95b..d702acf7e25 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistryFactory.java +++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistryFactory.java @@ -17,6 +17,7 @@ package org.apache.dubbo.registry.nacos; import org.apache.dubbo.common.URL; +import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.registry.Registry; import org.apache.dubbo.registry.RegistryFactory; import org.apache.dubbo.registry.support.AbstractRegistryFactory; @@ -24,7 +25,6 @@ import com.alibaba.nacos.api.NacosFactory; import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.api.naming.NamingService; -import com.alibaba.nacos.client.naming.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory;