The Spring Cloud Services Gateway

         

Micro services architecture system, the system architecture diagram after use API service gateway as follows:

The main role of API service gateway as follows:

  • Unified access portal service
  • Load balancing service access
  • Service access routing functions

In SpringCloud based on Netflix and Zuul components to implement the API gateway function, the following first to build a service gateway project:

1. pom file

   

 
 

<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.1.3.RELEASE</version>
</parent>

 

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
</properties>


<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-dependencies</artifactId>
      <version>${spring-cloud.version}</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>


<
dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-zuul</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies>

 

Guess you like

Origin www.cnblogs.com/hzhuxin/p/11016410.html