SpringCloudインスタンス-サービスインタフェースゲートウェイの構築4

3801 ワード

サービスインタフェースゲートウェイを構築し、インタフェースゲートウェイは主にサービス間のドメイン間問題を解決した.
プロファイル:

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8888/eureka/
server:
  port: 8769
spring:
  application:
    name: eureak-zuul

###       /api-member/**       eureak-member  ,       /api-order/**       eureak-order  ###
zuul:
  routes:
    api-a:
      path: /api-member/**
      service-id: eureak-member
    api-b:
      path: /api-order/**
      service-id: eureak-order


起動クラス:
package com.serverzuul.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

//    
@EnableZuulProxy
@SpringBootApplication
@EnableEurekaClient
public class ZuulApplication {

	public static void main(String[] args) {
		SpringApplication.run(ZuulApplication.class, args);
	}
}

pomファイル:

	4.0.0
	com.serverzuul
	
	service-newzuul
	0.0.1-SNAPSHOT

	
		org.springframework.boot
		spring-boot-starter-parent
		1.5.2.RELEASE
		 
	

	
		UTF-8
		UTF-8
		1.8
	

	
		
			org.springframework.cloud
			spring-cloud-starter-eureka
		
		
			org.springframework.cloud
			spring-cloud-starter-zuul
		
		
			org.springframework.boot
			spring-boot-starter-web
		

		
			org.springframework.boot
			spring-boot-starter-test
			test
		
	

	
		
			
				org.springframework.cloud
				spring-cloud-dependencies
				Dalston.RC1
				pom
				import
			
		
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
			
		
	

	
		
			spring-milestones
			Spring Milestones
			https://repo.spring.io/milestone
			
				false
			
		
	



開始ページ:
SpringCloud实例-搭建服务接口网关四_第1张图片
SpringCloud实例-搭建服务接口网关四_第2张图片