Dubbo+Zookeeper分布式服务的搭建
搭建过程:
一、我们要下载Zookeeper并安装、配置
下载地址:http://apache.fayea.com/zookeeper/ 我下载的是3.5.3-beta 测试版本进行搭建的,大家可以选择稳定版
我们把下载下来的zookeeper进行解压,打开后我们进入到 zookeeper-3.5.3\conf 这个文件夹
打开zoo.cfg,对zookeeper的端口和log、data进行配置
返回,进入bin目录我们启动zkServer.cmd,zookeeper就启动了
二、下载配置dubbo的管理项目
下载地址:https://download.csdn.net/download/qq_27612843/10465247
接下来我们需要准备个tomcat,改好端口,避免冲突,并且把下载的dubbo-admin.war放入到webapps里面
启动后会自动解压,这里要说一下流程,必须得是先启动zookeeper注册中心,然后再启动dubbo-admin服务
还有一个需要注意的地方是在 webapps—>dubbo-admin—>WEB-INF—>dubbo.properties文件中的zookeeper端口必须要和你zookeeper的端口保持一致
启动tomcat之后我们进行访问可以看到会让我们输入用户名和密码,都是root
登录进去之后就是dubbo的管理项目
三、接下来我们来创建我们的dubbo项目,这里我采用maven聚合来进行搭建
dubbo 父节点 Packaging——pom
dubbo-api 接口(也就是我们的service接口) Packaging——jar
dubbo-provider 服务提供方(这里面写service的实现和数据持久)、需要在pom中引入dubbo-api Packaging——war
dubbo-consumer 消费方(可以理解为controller层的调用)、需要在pom中引入dubbo-api Packaging——war
下面搭建流程就是一个maven聚合,我把各个程序里面所需要的配置贴出来
1、dubbo-api什么都不需要配置,只用写出我们一个接口即可
2、dubbo-provider的pom.xml的配置,dubbo自带的spring版本较低对其进行替换,大家自行把groupId和artifactId改名
-
<?xml version="1.0"?>
-
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
<modelVersion>4.0.0</modelVersion>
-
<parent>
-
<groupId>com.dubbo</groupId>
-
<artifactId>dubbo</artifactId>
-
<version>0.0.1-SNAPSHOT</version>
-
</parent>
-
<artifactId>dubbo-provider</artifactId>
-
<packaging>war</packaging>
-
<name>dubbo-provider Maven Webapp</name>
-
<url>http://maven.apache.org</url>
-
<properties>
-
<spring.version>4.3.8.RELEASE</spring.version>
-
</properties>
-
<dependencies>
-
<dependency>
-
<groupId>junit</groupId>
-
<artifactId>junit</artifactId>
-
<version>3.8.1</version>
-
<scope>test</scope>
-
</dependency>
-
<dependency>
-
<groupId>com.dubbo</groupId>
-
<artifactId>dubbo-api</artifactId>
-
<version>0.0.1-SNAPSHOT</version>
-
</dependency>
-
<dependency>
-
<groupId>com.alibaba</groupId>
-
<artifactId>dubbo</artifactId>
-
<version>2.5.3</version>
-
<exclusions>
-
<exclusion>
-
<artifactId>spring</artifactId>
-
<groupId>org.springframework</groupId>
-
</exclusion>
-
</exclusions>
-
</dependency>
-
<dependency>
-
<groupId>org.apache.zookeeper</groupId>
-
<artifactId>zookeeper</artifactId>
-
<version>3.5.3-beta</version>
-
</dependency>
-
<!-- spring begin -->
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-jdbc</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-context</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-aop</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-core</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-test</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-test</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<!-- spring end -->
-
<!-- 日志相关 -->
-
<dependency>
-
<groupId>log4j</groupId>
-
<artifactId>log4j</artifactId>
-
<version>1.2.16</version>
-
</dependency>
-
<dependency>
-
<groupId>org.slf4j</groupId>
-
<artifactId>slf4j-api</artifactId>
-
<version>1.7.5</version>
-
</dependency>
-
<!-- zookeeper client依赖,用于向zookeeper注册服务 -->
-
<dependency>
-
<groupId>com.github.sgroschupf</groupId>
-
<artifactId>zkclient</artifactId>
-
<version>0.1</version>
-
</dependency>
-
</dependencies>
-
<build>
-
<pluginManagement>
-
<plugins>
-
<plugin>
-
<groupId>org.apache.maven.plugins</groupId>
-
<artifactId>maven-jar-plugin</artifactId>
-
<configuration>
-
<source>1.8</source>
-
<target>1.8</target>
-
<archive>
-
<manifest>
-
<mainClass>com.dubbo.provider.Provider</mainClass>
-
<addClasspath>true</addClasspath>
-
<classpathPrefix>lib/</classpathPrefix>
-
</manifest>
-
</archive>
-
<classesDirectory>
-
</classesDirectory>
-
</configuration>
-
</plugin>
-
</plugins>
-
</pluginManagement>
-
<finalName>dubbo-provider</finalName>
-
</build>
-
</project>
applicationContext.xml
-
<?xml version="1.0" encoding="UTF-8"?>
-
<beans xmlns="http://www.springframework.org/schema/beans"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
-
xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
-
xmlns:tx="http://www.springframework.org/schema/tx"
-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
-
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
-
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
-
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
-
<context:component-scan base-package="com.dubbo.provider" />
-
</beans>
log4.properties
-
log4j.appender.mylog = org.apache.log4j.ConsoleAppender
-
log4j.appender.mylog.target = System.out
-
log4j.appender.mylog.layout= org.apache.log4j.PatternLayout
-
log4j.appender.mylog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n
-
log4j.appender.my2log = org.apache.log4j.RollingFileAppender
-
log4j.appender.my2log.File = D://Logger//provider.log
-
log4j.appender.my2log.MaxFileSize = 50KB
-
log4j.appender.my2log.MaxBackupIndex = 1
-
log4j.appender.my2log.layout= org.apache.log4j.PatternLayout
-
log4j.appender.my2log.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n
-
log4j.rootLogger = info,mylog,my2log
provider.xml
-
<?xml version="1.0" encoding="UTF-8"?>
-
<beans xmlns="http://www.springframework.org/schema/beans"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
<!-- 提供方应用信息,用于计算依赖关系 -->
-
<dubbo:application name="provider" />
-
<!-- 使用zookeeper广播注册中心暴露服务地址 -->
-
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
-
<!-- 用dubbo协议在20880端口暴露服务 -->
-
<dubbo:protocol name="dubbo" port="20881" />
-
<!-- 和本地bean一样实现服务 -->
-
<bean id="testService" class="com.dubbo.provider.service.TestServiceImpl" />
-
<!-- 声明需要暴露的服务接口 -->
-
<dubbo:service interface="com.dubbo.api.TestService" ref="testService" />
-
</beans>
api接口的实现类
对于服务方发布的main方法,Provider类
-
package com.dubbo.provider;
-
import org.apache.log4j.PropertyConfigurator;
-
import org.springframework.context.support.ClassPathXmlApplicationContext;
-
public class Provider {
-
static{
-
PropertyConfigurator.configure("src/main/resources/log4.properties");
-
}
-
public static void main(String args[]) throws Exception {
-
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:/*.xml");
-
context.start();
-
System.in.read();
-
}
-
}
我们用main方法启动后进入dubbo-admin里面去查看一下,会发现我们的服务已经发布了
3、接下来编写消费者项目代码及配置 dubbo-consumer
首先是pom.xml的配置
-
<?xml version="1.0"?>
-
<project
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
<modelVersion>4.0.0</modelVersion>
-
<parent>
-
<groupId>com.dubbo</groupId>
-
<artifactId>dubbo</artifactId>
-
<version>0.0.1-SNAPSHOT</version>
-
</parent>
-
<artifactId>dubbo-consumer</artifactId>
-
<packaging>war</packaging>
-
<name>dubbo-consumer Maven Webapp</name>
-
<url>http://maven.apache.org</url>
-
<properties>
-
<spring.version>4.3.8.RELEASE</spring.version>
-
</properties>
-
<dependencies>
-
<dependency>
-
<groupId>junit</groupId>
-
<artifactId>junit</artifactId>
-
<version>3.8.1</version>
-
<scope>test</scope>
-
</dependency>
-
<dependency>
-
<groupId>com.dubbo</groupId>
-
<artifactId>dubbo-api</artifactId>
-
<version>0.0.1-SNAPSHOT</version>
-
</dependency>
-
<dependency>
-
<groupId>com.alibaba</groupId>
-
<artifactId>dubbo</artifactId>
-
<version>2.5.3</version>
-
<exclusions>
-
<exclusion>
-
<artifactId>spring</artifactId>
-
<groupId>org.springframework</groupId>
-
</exclusion>
-
</exclusions>
-
</dependency>
-
<!-- spring begin -->
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-webmvc</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-jdbc</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-context</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-aop</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-core</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-test</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<dependency>
-
<groupId>org.springframework</groupId>
-
<artifactId>spring-test</artifactId>
-
<version>${spring.version}</version>
-
</dependency>
-
<!-- spring end -->
-
<!-- web jar -->
-
<dependency>
-
<groupId>javax.servlet</groupId>
-
<artifactId>javax.servlet-api</artifactId>
-
<version>3.0.1</version>
-
<scope>provided</scope>
-
</dependency>
-
<dependency>
-
<groupId>javax.servlet</groupId>
-
<artifactId>jstl</artifactId>
-
<version>1.1.2</version>
-
<scope>provided</scope>
-
</dependency>
-
<dependency>
-
<groupId>javax.servlet.jsp</groupId>
-
<artifactId>javax.servlet.jsp-api</artifactId>
-
<version>2.3.1</version>
-
<scope>provided</scope>
-
</dependency>
-
<!-- jstl jar -->
-
<dependency>
-
<groupId>jstl</groupId>
-
<artifactId>jstl</artifactId>
-
<version>1.2</version>
-
</dependency>
-
<dependency>
-
<groupId>taglibs</groupId>
-
<artifactId>standard</artifactId>
-
<version>1.1.2</version>
-
</dependency>
-
<!-- jackson jar -->
-
<dependency>
-
<groupId>org.codehaus.jackson</groupId>
-
<artifactId>jackson-jaxrs</artifactId>
-
<version>1.9.11</version>
-
</dependency>
-
<!-- commons jar -->
-
<dependency>
-
<groupId>org.apache.commons</groupId>
-
<artifactId>commons-lang3</artifactId>
-
<version>3.3.2</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-io</groupId>
-
<artifactId>commons-io</artifactId>
-
<version>2.4</version>
-
</dependency>
-
<dependency>
-
<groupId>org.apache.commons</groupId>
-
<artifactId>commons-collections4</artifactId>
-
<version>4.0</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-logging</groupId>
-
<artifactId>commons-logging</artifactId>
-
<version>1.1.3</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-codec</groupId>
-
<artifactId>commons-codec</artifactId>
-
<version>1.8</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-beanutils</groupId>
-
<artifactId>commons-beanutils</artifactId>
-
<version>1.8.3</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-chain</groupId>
-
<artifactId>commons-chain</artifactId>
-
<version>1.2</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-fileupload</groupId>
-
<artifactId>commons-fileupload</artifactId>
-
<version>1.3.1</version>
-
</dependency>
-
<dependency>
-
<groupId>org.apache.commons</groupId>
-
<artifactId>commons-math3</artifactId>
-
<version>3.3</version>
-
</dependency>
-
<dependency>
-
<groupId>org.apache.commons</groupId>
-
<artifactId>commons-pool2</artifactId>
-
<version>2.2</version>
-
</dependency>
-
<dependency>
-
<groupId>org.apache.commons</groupId>
-
<artifactId>commons-digester3</artifactId>
-
<version>3.2</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-net</groupId>
-
<artifactId>commons-net</artifactId>
-
<version>3.3</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-dbutils</groupId>
-
<artifactId>commons-dbutils</artifactId>
-
<version>1.5</version>
-
</dependency>
-
<dependency>
-
<groupId>org.apache.commons</groupId>
-
<artifactId>commons-email</artifactId>
-
<version>1.3.3</version>
-
</dependency>
-
<dependency>
-
<groupId>commons-dbcp</groupId>
-
<artifactId>commons-dbcp</artifactId>
-
<version>1.4</version>
-
</dependency>
-
<!-- 日志相关 -->
-
<dependency>
-
<groupId>log4j</groupId>
-
<artifactId>log4j</artifactId>
-
<version>1.2.16</version>
-
</dependency>
-
<dependency>
-
<groupId>org.slf4j</groupId>
-
<artifactId>slf4j-api</artifactId>
-
<version>1.7.5</version>
-
</dependency>
-
<!-- zookeeper client依赖,用于向zookeeper注册服务 -->
-
<dependency>
-
<groupId>com.github.sgroschupf</groupId>
-
<artifactId>zkclient</artifactId>
-
<version>0.1</version>
-
</dependency>
-
</dependencies>
-
<build>
-
<finalName>dubbo-consumer</finalName>
-
</build>
-
</project>
web.xml
-
<?xml version="1.0" encoding="utf-8"?>
-
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xmlns="http://java.sun.com/xml/ns/javaee"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
-
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
-
id="WebApp_ID" version="3.0">
-
<!-- 关键配置 contextListener -->
-
<context-param>
-
<param-name>contextConfigLocation</param-name>
-
<param-value>classpath*:applicationContext.xml</param-value>
-
</context-param>
-
<listener>
-
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-
</listener>
-
<!-- log4 -->
-
<context-param>
-
<param-name>log4jConfigLocation</param-name>
-
<param-value>classpath:log4.properties</param-value>
-
</context-param>
-
<context-param>
-
<param-name>log4jRefreshInterval</param-name>
-
<param-value>3000</param-value>
-
</context-param>
-
<listener>
-
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
-
</listener>
-
<!-- 字符过滤器 -->
-
<filter>
-
<filter-name>encodingFilter</filter-name>
-
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
-
<init-param>
-
<param-name>encoding</param-name>
-
<param-value>UTF-8</param-value>
-
</init-param>
-
</filter>
-
<filter-mapping>
-
<filter-name>encodingFilter</filter-name>
-
<url-pattern>/</url-pattern>
-
</filter-mapping>
-
<!-- 设置tomcat对静态资源默认拦截 -->
-
<servlet-mapping>
-
<servlet-name>default</servlet-name>
-
<url-pattern>*.jpg</url-pattern>
-
</servlet-mapping>
-
<servlet-mapping>
-
<servlet-name>default</servlet-name>
-
<url-pattern>*.png</url-pattern>
-
</servlet-mapping>
-
<servlet-mapping>
-
<servlet-name>default</servlet-name>
-
<url-pattern>*.js</url-pattern>
-
</servlet-mapping>
-
<servlet-mapping>
-
<servlet-name>default</servlet-name>
-
<url-pattern>*.css</url-pattern>
-
</servlet-mapping>
-
<!-- 关键配置 dispatcherServlet -->
-
<!-- 拦截所有的请求,包括静态资源 -->
-
<servlet>
-
<servlet-name>springmvc</servlet-name>
-
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-
<init-param>
-
<param-name>contextConfigLocation</param-name>
-
<param-value>classpath*:springmvc.xml</param-value>
-
</init-param>
-
<load-on-startup>1</load-on-startup>
-
</servlet>
-
<servlet-mapping>
-
<servlet-name>springmvc</servlet-name>
-
<url-pattern>/</url-pattern>
-
</servlet-mapping>
-
<welcome-file-list>
-
<welcome-file>index.jsp</welcome-file>
-
</welcome-file-list>
-
</web-app>
applicationContext.xml
-
<?xml version="1.0" encoding="UTF-8"?>
-
<beans xmlns="http://www.springframework.org/schema/beans"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
-
xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
-
xmlns:tx="http://www.springframework.org/schema/tx"
-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
-
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
-
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
-
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
-
<import resource="classpath*:/consumer.xml" />
-
</beans>
consumer.xml
-
<?xml version="1.0" encoding="UTF-8"?>
-
<beans xmlns="http://www.springframework.org/schema/beans"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
-
xsi:schemaLocation="http://www.springframework.org/schema/beans
-
http://www.springframework.org/schema/beans/spring-beans.xsd
-
http://code.alibabatech.com/schema/dubbo
-
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
<!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
-
<dubbo:application name="consumer" />
-
<!-- 使用zookeeper广播注册中心暴露服务地址 -->
-
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
-
<!-- 生成远程服务代理,可以和本地bean一样使用demoService -->
-
<dubbo:reference id="testService" interface="com.dubbo.api.TestService" />
-
</beans>
log4.properties
-
log4j.appender.mylog = org.apache.log4j.ConsoleAppender
-
log4j.appender.mylog.target = System.out
-
log4j.appender.mylog.layout= org.apache.log4j.PatternLayout
-
log4j.appender.mylog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n
-
log4j.appender.my2log = org.apache.log4j.RollingFileAppender
-
log4j.appender.my2log.File = D://Logger//consumer.log
-
log4j.appender.my2log.MaxFileSize = 50KB
-
log4j.appender.my2log.MaxBackupIndex = 1
-
log4j.appender.my2log.layout= org.apache.log4j.PatternLayout
-
log4j.appender.my2log.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n
-
log4j.rootLogger = info,mylog,my2log
springmvc.xml
-
<?xml version="1.0" encoding="UTF-8"?>
-
<beans xmlns="http://www.springframework.org/schema/beans"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
-
xmlns:context="http://www.springframework.org/schema/context"
-
xmlns:mvc="http://www.springframework.org/schema/mvc"
-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
-
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
-
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd"
-
default-lazy-init="true">
-
<!-- 启用注解 -->
-
<context:annotation-config />
-
<!-- 扫描Controller -->
-
<context:component-scan base-package="com.dubbo.consumer.controller" />
-
<!-- 完成请求与注解的POJO映射 -->
-
<bean
-
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
-
<bean
-
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
-
<bean id="defaultViewResolver"
-
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
-
p:order="3">
-
<property name="viewClass"
-
value="org.springframework.web.servlet.view.JstlView" />
-
<property name="contentType" value="text/html" />
-
<property name="prefix" value="/" />
-
<property name="suffix" value=".jsp" />
-
</bean>
-
</beans>
controller
四、启动我们的消费方,dubbo-consumer(这里要注意一下,在拿个tomcat出来,不要和dubbo-admin用同一个)
这个时候我们进入dubbo-admin里面去查看一下消费方
然后这里大家可以用url去测试,也可以用postman去测试
点击Send发送请求后我们可以看到控制台的输出