EventPublishingConfigService implements ConfigService, NacosServiceMetaData { public void addListener(String dataId, String group, String type, Listener listener) throws NacosException { Listener listenerAdapter = new DelegatingEventPublishingListener(configService, dataId, group, type, applicationEventPublisher, executor, listener); addListener(dataId, group, listenerAdapter); } EventPublishingConfigService(ConfigService configService,
			Properties properties, ConfigurableApplicationContext context,
			Executor executor); @Override String getConfig(String dataId, String group, long timeoutMs); @Override String getConfigAndSignListener(String dataId, String group, long timeoutMs,
			Listener listener); void addListener(String dataId, String group, String type, Listener listener); @Override void addListener(String dataId, String group, Listener listener); @Override boolean publishConfig(String dataId, String group, String content); @Override boolean removeConfig(String dataId, String group); @Override void removeListener(String dataId, String group, Listener listener); @Override String getServerStatus(); @Override Properties getProperties();  }
@Test public void testAddListener() throws NacosException { final Listener listener = new AbstractListener() { @Override public void receiveConfigInfo(String configInfo) { Assert.assertEquals(CONTENT, configInfo); } }; context.addApplicationListener( new ApplicationListener<NacosConfigReceivedEvent>() { @Override public void onApplicationEvent(NacosConfigReceivedEvent event) { assertNacosConfigEvent(event); Assert.assertEquals(CONTENT, event.getContent()); } }); context.addApplicationListener( new ApplicationListener<NacosConfigListenerRegisteredEvent>() { @Override public void onApplicationEvent( NacosConfigListenerRegisteredEvent event) { assertNacosConfigEvent(event); Assert.assertTrue(event.isRegistered()); Assert.assertEquals(listener, event.getListener()); } }); configService.addListener(DATA_ID, GROUP_ID, listener); configService.publishConfig(DATA_ID, GROUP_ID, CONTENT); }