NacosDynamicConfiguration implements DynamicConfiguration { @Override public String getConfig(String key, String group, long timeout) throws IllegalStateException { String resolvedGroup = resolveGroup(group); try { long nacosTimeout = timeout < 0 ? getDefaultTimeout() : timeout; if (StringUtils.isEmpty(resolvedGroup)) { resolvedGroup = DEFAULT_GROUP; } return configService.getConfig(key, resolvedGroup, nacosTimeout); } catch (NacosException e) { logger.error(e.getMessage()); } return null; } NacosDynamicConfiguration(URL url); @Override void addListener(String key, String group, ConfigurationListener listener); @Override void removeListener(String key, String group, ConfigurationListener listener); @Override String getConfig(String key, String group, long timeout); @Override Object getInternalProperty(String key); @Override boolean publishConfig(String key, String group, String content); @Override long getDefaultTimeout(); @Override SortedSet<String> getConfigKeys(String group); @Override boolean removeConfig(String key, String group);  }
@Test public void testGetConfig() throws Exception { put("org.apache.dubbo.nacos.testService.configurators", "hello"); Thread.sleep(200); put("dubbo.properties", "test", "aaa=bbb"); Thread.sleep(200); put("org.apache.dubbo.demo.DemoService:1.0.0.test:xxxx.configurators", "helloworld"); Thread.sleep(200); Assertions.assertEquals("hello", config.getConfig("org.apache.dubbo.nacos.testService.configurators", DynamicConfiguration.DEFAULT_GROUP)); Assertions.assertEquals("aaa=bbb", config.getConfig("dubbo.properties", "test")); Assertions.assertEquals("helloworld", config.getConfig("org.apache.dubbo.demo.DemoService:1.0.0.test:xxxx.configurators", DynamicConfiguration.DEFAULT_GROUP)); }