您当前的位置: 首页 >  spring

18SpringCloud - 服务网关 zuul项目示例

杨林伟 发布时间:2019-05-22 11:11:06 ,浏览量:3

新建项目spring-cloud-zuul-service

添加依赖

    org.springframework.cloud
    spring-cloud-starter-zuul

开启服务注册

在程序的启动类 ZuulApplication通过 @EnableZuulProxy 开启 Zuul 服务网关

@EnableZuulProxy
@SpringBootApplication
public class ZuulApplication {
    public static void main(String[] args) {
        SpringApplication.run(ZuulApplication.class, args);
    }
}
添加配置

配置文件 application.yml

spring:
  application:
    name: zuul-service
server:
  port: 9000
zuul:
  routes:
    blog:
        path: /ymq/**
        url: http://www.xxx.io/about
关注
打赏
1688896170
查看更多评论

杨林伟

暂无认证

  • 3浏览

    0关注

    3183博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.1132s