记录在学习springcloud过程中,在springboot2.0环境下实现,所遇到的坑和感悟。
学习的教程:
史上最简单的SpringCloud教程 | 第五篇: 路由网关(zuul)(Finchley版本)
一.修改pom配置
- springboot版本为,2.0.6.RELEASE:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
- dependencyManagement修改为:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
二.zuul报f错误 com.netflix.zuul.exception.ZuulException: Forwarding error
在application.properties加上:
zuul.max.host.connections = 500
zuul.host.socket-timeout-millis = 60000
zuul.host.connect-timeout-millis = 60000
大致原因,转发超时,zuul启动的首次转发比较耗时。
参考:https://www.cnblogs.com/dauber/p/9424505.html