<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->

- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 3.0.5
* Operating System version: xxx
* Java version: xxx

### Steps to reproduce this issue

Frequent exceptions in unit testing: 

```
[INFO] [02/11/21 06:31:32:300 UTC] ERROR listener.ServiceInstancesChangedListener:  [DUBBO] Failed to load service metadata, meta type is local, dubbo version: 3.0.5-SNAPSHOT, current host: 172.28.16.1
[INFO] java.lang.IllegalStateException: There's no ApplicationConfig specified.
[INFO] 	at org.apache.dubbo.config.context.ConfigManager.lambda$getApplicationOrElseThrow$0(ConfigManager.java:85)
[INFO] 	at java.util.Optional.orElseThrow(Optional.java:290)
[INFO] 	at org.apache.dubbo.config.context.ConfigManager.getApplicationOrElseThrow(ConfigManager.java:85)
[INFO] 	at org.apache.dubbo.rpc.model.ApplicationModel.getCurrentConfig(ApplicationModel.java:315)
[INFO] 	at org.apache.dubbo.registry.client.metadata.StandardMetadataServiceURLBuilder.generateUrlWithoutMetadata(StandardMetadataServiceURLBuilder.java:112)
[INFO] 	at org.apache.dubbo.registry.client.metadata.StandardMetadataServiceURLBuilder.build(StandardMetadataServiceURLBuilder.java:82)
[INFO] 	at org.apache.dubbo.registry.client.metadata.MetadataUtils.referProxy(MetadataUtils.java:93)
[INFO] 	at org.apache.dubbo.registry.client.metadata.MetadataUtils.lambda$getMetadataServiceProxy$0(MetadataUtils.java:67)
[INFO] 	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
[INFO] 	at org.apache.dubbo.registry.client.metadata.MetadataUtils.getMetadataServiceProxy(MetadataUtils.java:67)
[INFO] 	at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.doGetMetadataInfo(ServiceInstancesChangedListener.java:379)
[INFO] 	at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.getRemoteMetadata(ServiceInstancesChangedListener.java:330)
[INFO] 	at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.onEvent(ServiceInstancesChangedListener.java:143)
[INFO] 	at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener$AddressRefreshRetryTask.run(ServiceInstancesChangedListener.java:493)
[INFO] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[INFO] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[INFO] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[INFO] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[INFO] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[INFO] 	at java.lang.Thread.run(Thread.java:748)
```

public void testCreateMetadataInvoker() {
        Map<String, String> metadata = new HashMap<>();
        metadata.put(EXPORTED_SERVICES_REVISION_PROPERTY_NAME, "1");
        ServiceInstance serviceInstance = mock(ServiceInstance.class);
        when(serviceInstance.getServiceName()).thenReturn(DemoService.class.getName());
        when(serviceInstance.getMetadata()).thenReturn(metadata);
        when(serviceInstance.getAddress()).thenReturn("127.0.0.1");
        when(serviceInstance.getApplicationModel()).thenReturn(ApplicationModel.defaultModel());
        String key = "org.apache.dubbo.registry.integration.DemoService##127.0.0.1##1";
        Assertions.assertFalse(MetadataUtils.metadataServiceProxies.containsKey(key));
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("application1");
        Map<String, String> parameters = new HashMap<>();
        parameters.put("key1", "value1");
        parameters.put("key2", "value2");
        applicationConfig.setMetadataServicePort(7001);
        applicationConfig.setParameters(parameters);
        ApplicationModel applicationModel = spy(ApplicationModel.defaultModel());
        applicationModel.getApplicationConfigManager().setApplication(applicationConfig);
        Protocol protocol = mock(Protocol.class);
        ProxyFactory proxyFactory = mock(ProxyFactory.class);
        Invoker<Object> invoker = mock(Invoker.class);
        MetadataService metadataService = mock(MetadataService.class);
        when(serviceInstance.getOrDefaultApplicationModel()).thenReturn(applicationModel);
        ExtensionLoader<Protocol> protocolExtensionLoader = mock(ExtensionLoader.class);
        when(protocolExtensionLoader.getAdaptiveExtension()).thenReturn(protocol);
        ExtensionLoader<ProxyFactory> proxyFactoryExtensionLoader = mock(ExtensionLoader.class);
        when(proxyFactoryExtensionLoader.getAdaptiveExtension()).thenReturn(proxyFactory);
        when(applicationModel.getExtensionLoader(Protocol.class)).thenReturn(protocolExtensionLoader);
        when(applicationModel.getExtensionLoader(ProxyFactory.class)).thenReturn(proxyFactoryExtensionLoader);