@Override
    public void register(ProviderConfig config) {
        String appName = config.getAppName();
        if (!registryConfig.isRegister()) {
            if (LOGGER.isInfoEnabled(appName)) {
                LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_REGISTRY_IGNORE));
            }
            return;
        }
        if (!config.isRegister()) { // 注册中心不注册或者服务不注册
            return;
        }
        List<ServerConfig> serverConfigs = config.getServer();
        if (CommonUtils.isNotEmpty(serverConfigs)) {
            for (ServerConfig server : serverConfigs) {
                String serviceName = MeshRegistryHelper.buildMeshKey(config, server.getProtocol());
                ProviderInfo providerInfo = MeshRegistryHelper.convertProviderToProviderInfo(config, server);
                if (LOGGER.isInfoEnabled(appName)) {
                    LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_ROUTE_REGISTRY_PUB_START, serviceName));
                }
                doRegister(appName, serviceName, providerInfo, server.getProtocol());

                if (LOGGER.isInfoEnabled(appName)) {
                    LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_ROUTE_REGISTRY_PUB_OVER, serviceName));
                }
            }
            if (EventBus.isEnable(ProviderPubEvent.class)) {
                ProviderPubEvent event = new ProviderPubEvent(config);
                EventBus.post(event);
            }

        }
    }
@Test
    public void testOnlyPublish() throws InterruptedException {

        Field registedAppField = null;
        try {
            registedAppField = MeshRegistry.class.getDeclaredField("registedApp");
            registedAppField.setAccessible(true);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }

        Boolean registedAppValue = null;
        // in case of effected by other case.
        try {
            registedAppValue = (Boolean) registedAppField.get(registry);
            registedAppField.set(registry, false);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        ServerConfig serverConfig = new ServerConfig()
            .setProtocol("bolt")
            .setHost("0.0.0.0")
            .setPort(12200);
        ProviderConfig<?> provider = new ProviderConfig();
        provider.setInterfaceId("com.alipay.xxx.TestService")
            .setUniqueId("unique123Id")
            .setApplication(new ApplicationConfig().setAppName("test-server"))
            .setProxy("javassist")
            .setRegister(true)
            .setRegistry(registryConfig)
            .setSerialization("hessian2")
            .setServer(serverConfig)
            .setWeight(222)
            .setTimeout(3000);

        registry.register(provider);
        Thread.sleep(3000);

        try {
            registedAppValue = (Boolean) registedAppField.get(registry);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        LOGGER.info("final registedAppValue is " + registedAppValue);

        Assert.assertTrue(registedAppValue);
    }