public interface HelloService { String sayHello(String name); } public class HelloServiceImpl implements HelloService { public String sayHello(String name) { return "Hello, " + name + "!"; } } public class Provider { public static void main(String[] args) throws IOException { InputStream inputStream = Provider.class.getResourceAsStream("/dubbo-provider.xml"); ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"dubbo-provider.xml"}); context.start(); } } <dubbo:application name="hello-provider" /> <dubbo:registry address="zookeeper://127.0.0.1:2181" /> <dubbo:protocol name="dubbo" port="20880" /> <dubbo:service interface="com.example.HelloService" ref="helloService" /> <bean id="helloService" class="com.example.HelloServiceImpl" />


上一篇:
下一篇:
切换中文