dubbo 点对点服务端

日期 2022-10-13

选取服务端核心关键部分

main 函数中

ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("provider.xml");
context.start();

provider.xml 中 端口8005

 

                    interface="com.www.service.ProviderService"
                    ref="ProviderService"
                    version="1.0.0"
                    timeout="3000">
     
 
 

public interface ProviderService {

    String SayHello(String word);
}

public class ProviderServiceImpl implements ProviderService{

    @Override
    public String SayHello(String word) {
        System.out.println("server:"+word);
        return "server return:"+word;
    }

}

pom 中添加


             com.alibaba
             dubbo
             2.6.6
            
            
            org.slf4jslf4j-log4j12
            

            

         

       
            io.netty
            netty-all
            4.1.32.Final
       

       
            org.apache.curator
            curator-framework
            2.8.0
       

       
            org.apache.curator
            curator-recipes
            2.8.0
       

 启动main 函数就可以了

你可能感兴趣的:(Java,dubbo,java,spring)