/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.dubbo.bootstrap;

import org.apache.dubbo.bootstrap.rest.UserService;
import org.apache.dubbo.bootstrap.rest.UserServiceImpl;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.builders.RegistryBuilder;

/**
 * Dubbo Provider Bootstrap
 *
 * @since 2.7.4
 */
public class DubboServiceProviderBootstrap {

    public static void main(String[] args) {
        ProtocolConfig restProtocol = new ProtocolConfig();
        restProtocol.setName("rest");
        restProtocol.setId("rest");
        restProtocol.setPort(-1);

        new DubboBootstrap()
                .application("dubbo-provider-demo")
                // Zookeeper in service registry type
//                .registry("zookeeper", builder -> builder.address("zookeeper://127.0.0.1:2181?registry-type=service"))
                // Nacos
//                .registry("zookeeper", builder -> builder.address("nacos://127.0.0.1:8848?registry-type=service"))
                .registry(RegistryBuilder.newBuilder().address("consul://127.0.0.1:8500?registry-type=service").build())
                .protocol(builder -> builder.port(-1).name("dubbo"))
                .service(builder -> builder.id("echo").interfaceClass(EchoService.class).ref(new EchoServiceImpl()))
                .service(builder -> builder.id("user").interfaceClass(UserService.class).ref(new UserServiceImpl()).addProtocol(restProtocol))
                .start()
                .await();
    }

    private static void testSCCallDubbo() {

    }

    private static void testDubboCallSC() {

    }

    private static void testDubboTansormation() {

    }
}

@@ -1022,32 +1022,94 @@
 fig.
-builders.RegistryBuilder
+RegistryConfig;%0Aimport org.apache.dubbo.config.ServiceConfig;%0A%0Aimport java.util.Arrays
 ;%0A%0A/
@@ -1253,16 +1253,100 @@
 args) %7B%0A
+        multipleRegistries();%0A    %7D%0A%0A    private static void multipleRegistries() %7B%0A
         
@@ -1506,16 +1506,1004 @@
 t(-1);%0A%0A
+        RegistryConfig interfaceRegistry = new RegistryConfig();%0A        interfaceRegistry.setId(%22interfaceRegistry%22);%0A        interfaceRegistry.setAddress(%22zookeeper://127.0.0.1:2181%22);%0A%0A        RegistryConfig serviceRegistry = new RegistryConfig();%0A        serviceRegistry.setId(%22serviceRegistry%22);%0A        serviceRegistry.setAddress(%22zookeeper://127.0.0.1:2181?registry-type=service%22);%0A%0A        ServiceConfig%3CEchoService%3E echoService = new ServiceConfig%3C%3E();%0A        echoService.setInterface(EchoService.class.getName());%0A        echoService.setRef(new EchoServiceImpl());%0A//        echoService.setRegistries(Arrays.asList(interfaceRegistry, serviceRegistry));%0A%0A        ServiceConfig%3CUserService%3E userService = new ServiceConfig%3C%3E();%0A        userService.setInterface(UserService.class.getName());%0A        userService.setRef(new UserServiceImpl());%0A        userService.setProtocol(restProtocol);%0A//        userService.setRegistries(Arrays.asList(interfaceRegistry, serviceRegistry));%0A%0A%0A
         
@@ -2884,32 +2884,113 @@
 type=service%22))%0A
+                .registries(Arrays.asList(interfaceRegistry, serviceRegistry))%0A//
                 
@@ -3192,241 +3192,57 @@
 ice(
-builder -%3E builder.id(%22echo%22).interfaceClass(EchoService.class).ref(new EchoServiceImpl()))%0A                .service(builder -%3E builder.id(%22user%22).interfaceClass(UserService.class).ref(new UserServiceImpl()).addProtocol(restProtocol)
+echoService)%0A                .service(userService
 )%0A  
@@ -3458,10 +3458,11 @@
 %0A%0A    %7D%0A
+%0A
 %7D%0A

change demo