spring cloud zuul

server:
  port: 9000
zuul:
  routes:
    source:
      url: http://localhost:8080

  

@SpringBootApplication
@EnableZuulProxy
public class RouterApp {

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

}

  

@SpringBootApplication
@RestController
public class SourceApp {

	public static void main(String[] args) {
		SpringApplication.run(SourceApp.class, args);
	}
	
	@RequestMapping(value = "/hello/{name}", method = RequestMethod.GET)
	public String hello(@PathVariable String name) {
		return "hello, " + name;
	}

}

  http://localhost:9000/source/hello/dd

posted @ 2018-03-12 23:02  zfzf1  阅读(116)  评论(0编辑  收藏  举报