dubbo框架的第一个demo

public interface DemoService {
String sayHello(String name);
}

public class DemoServiceImpl implements DemoService{

@Override
public String sayHello(String name) {
	
	return "Hello"+name;
}

}
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Provider {
public static void main(String[] args) throws Exception {
System.setProperty(“java.net.preferIPv4Stack”, “true”);
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{“Test/src/com/sxf/provider.xml”});
context.start();
System.out.println(“Provider started.”);
System.in.read();
}
}


<dubbo:application name=“demo-provider”/>

<dubbo:registry address=“multicast://224.5.6.7:1234”/>

<dubbo:protocol name="dubbo" port="20880"/>

<bean id="demoService" class="org.apache.dubbo.demo.provider.DemoServiceImpl"/>

<dubbo:service interface="org.apache.dubbo.demo.DemoService" ref="demoService"/>

猜你喜欢

转载自blog.csdn.net/weixin_37565521/article/details/84672559