Issue 1:
[*] I have searched the issues of this repository and believe that this is not a duplicate.

[*] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.5-SNAPSHOT

Dubbo branch: master

Operating System version: macOS Catalina

Java version: jdk-11.0.5

Steps to reproduce this issue

start zookeeper in localhost and port is 2181

write provider-side code

start provider, the provider-side code looks like this

public class Application {

private static String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1");

public static void main(String[] args) throws Exception {
ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
service.setApplication(new ApplicationConfig("first-dubbo-provider"));
service.setRegistry(new RegistryConfig("zookeeper://" + zookeeperHost + ":2181"));
service.setInterface(DemoService.class);
service.setRef(new DemoServiceImpl());
service.export();

System.out.println("dubbo service started");
new CountDownLatch(1).await();
}
}

Actual Result

But I got an exception.

Exception in thread "main" java.lang.NullPointerException
at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$useRegistryForConfigIfNecessary$7(AbstractInterfaceConfig.java:628)
at java.base/java.util.Optional.orElseGet(Optional.java:369)
at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$useRegistryForConfigIfNecessary$8(AbstractInterfaceConfig.java:620)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at org.apache.dubbo.config.AbstractInterfaceConfig.useRegistryForConfigIfNecessary(AbstractInterfaceConfig.java:618)
at org.apache.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:208)
at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:303)
at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:370)
at com.example.studydubboProvider.Application.main(Application.java:22)

Is this an issue?

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.5

Operating System version: CentOS7

Java version: JDK8

Steps to reproduce this issue

I just updated my application from DUBBO 2.7.3 to 2.7.5. Then I find my 3 group services of same interface lost 2 of them in the registry (NACOS). I also use dubbo-spring-boot-samples /org.apache.dubbo.spring.boot.demo.provider to verify and get the same problem. The following are my steps:

I difine two @Services implementations of a same interface and use "group" to identify each one.

@service(group="s1", version = "1.0.0")
public class DefaultDemoService implements DemoService {}

@service(group="s2", version = "1.0.0")
public class DefaultDemoService2 implements DemoService {}

then got the following logs, and only find service with group s1 has registered in NACOS. If I downgrade dubbo to 2.7.3, everything works well as before.

2020-03-26 18:34:03.243 INFO 12596 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] The BeanDefinition[Root bean: class [org.apache.dubbo.config.spring.ServiceBean]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] of ServiceBean has been registered with name : **ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s1**, dubbo version: 2.7.5, current host: ...
2020-03-26 18:34:03.246 INFO 12596 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] The BeanDefinition[Root bean: class [org.apache.dubbo.config.spring.ServiceBean]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] of ServiceBean has been registered with name : **ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s2**, dubbo version: 2.7.5, current host: ...

2020-03-26 18:34:04.195 WARN 12596 --- [ main] o.a.dubbo.config.context.**ConfigManager** : [DUBBO] **Duplicate ServiceBean found**, there already has one default ServiceBean or more than two ServiceBeans have the same id, you can try to give each ServiceBean a different id : <dubbo:service beanName="ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s2" exported="false" unexported="false" ref="org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService2@abf688e" prefix="dubbo.service.org.apache.dubbo.spring.boot.demo.consumer.DemoService" uniqueServiceName="s2/org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0" interface="org.apache.dubbo.spring.boot.demo.consumer.DemoService" dynamic="true" version="1.0.0" deprecated="false" group="s2" id="**org.apache.dubbo.spring.boot.demo.consumer.DemoService**" valid="true" />, dubbo version: 2.7.5, current host: ...

I tried add "provider" for @service :

@service(provider = "defaultDemoService", group="s1", version = "1.0.0")
public class DefaultDemoService implements DemoService {}

@service(provider = "defaultDemoService2", group="s2", version = "1.0.0")
public class DefaultDemoService2 implements DemoService {}

then got the fllowing logs:

2020-03-26 22:27:19.428 WARN 7068 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s1': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService' to required type 'org.apache.dubbo.config.ProviderConfig' for property 'provider'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService' to required type 'org.apache.dubbo.config.ProviderConfig' for property 'provider': no matching editors or conversion strategy found

I compared the ConfigManager 2.7.3 against 2.7.5, New version add "checkDuplicate" features. I also notice DUBBO may use @service(provider="id") as Bean ID, I tried use this attribute, But also failed with other exceptions.

Pls. provide [GitHub address] to reproduce this issue.

https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-samples/auto-configure-samples/provider-sample

Expected Result

I want to use @service(group) to register all my services.

Actual Result

Encounter 'Duplicate ServiceBean found'、Failed to convert property value of type failure.