天天看点

springcloud中zuul的应用

zuul常用作网关服务,本例使用zuul作为网关限流服务

一.pom.xml依赖

<dependencyManagement> 
        <dependencies> 
            <dependency> 
                <groupId>org.springframework.cloud</groupId> 
                <artifactId>spring-cloud-netflix</artifactId> 
                <version>1.2.3.RELEASE</version> 
                <type>pom</type> 
                <scope>import</scope> 
            </dependency> 
        </dependencies> 
    </dependencyManagement>
           

<dependency> 
            <groupId>org.springframework.cloud</groupId> 
            <artifactId>spring-cloud-starter-zuul</artifactId> 
        </dependency>
           

二.注册zuul过滤器

package zuul;

import java.io.IOException;
imp