Spring Cloud Zuul 을 사용 하여 동적 경로 구현

Zuul 은 동적 경로,모니터링,탄력성,안전 등 을 제공 하 는 변두리 서비스 입 니 다.쥴 은 장치 와 넷 플 릭 스 스 스 트림 애플 리 케 이 션 의 웹 사이트 백 엔 드 모든 요청 의 앞문 에 해당 한다.
Zuul 은 여러 Amazon Auto Scaling Groups 에 대한 경로 요청 을 적 절 히 할 수 있 습 니 다.
우선 Maven 프로젝트 를 새로 만 들 고 다음 의존 도 를 추가 합 니 다.

	
		
			org.springframework.cloud
			spring-cloud-netflix
			1.1.3.RELEASE
			pom
			import
		
	



	
		org.springframework.cloud
		spring-cloud-starter-hystrix
	
	
		org.springframework.cloud
		spring-cloud-starter-zuul
	
package com.pp.zuul;

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

@EnableZuulProxy
@SpringBootApplication
public class App  {
    public static void main( String[] args ) {
    	SpringApplication.run(App.class, args);
    }
}

설정 파일:application.properties
package com.pp.zuul;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HomeController {
	
	@RequestMapping("/index")
	public Object index() {
		return "index";
	}
	
	@RequestMapping("/home")
	public Object home() {
		return "home";
	}
}

좋은 웹페이지 즐겨찾기