Dubbo 03: 直连式 + 接口工程( 二 )

  • web.xml
    【Dubbo 03: 直连式 + 接口工程】<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"version="4.0"><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:dubbo-link-userservice-provider.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener></web-app>
  • 提供的服务实现
    package com.example.dubbo.service.impl;import com.example.dubbo.model.User;import com.example.dubbo.service.UserService;public class userServiceImpl implements UserService {@Overridepublic User queryUserById(String id) {User user = new User();user.setId(id);user.setName("橘子");user.setAge("18");return user;}@Overridepublic int queryAllUserCount() {return 3;}}
  • 工程3