Spring Cloud Zuul Simple to use

Source: Internet
Author: User


Summarize the structure of Spring cloud:
1, the request unifies through the API Gateway (Zuul) to access the internal service.
2, the gateway received the request, from the registry (Eureka) to obtain available services
3, after the balanced load by the ribbon, distributed to the backend specific examples
4, micro-services through the feign communication processing business
5, Hystrix is responsible for processing service time out fuse
6, turbine monitoring services between the call and fuse-related indicators Spring Cloud Zuul Simple use add dependencies

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

2. Configuration file

Spring.application.name=gateway-service-zuul
server.port=8888

#这里的配置表示, Access/it/** Direct redirect to http:// www.ityouknow.com/**
zuul.routes.baidu.path=/it/**
zuul.routes.baidu.url=http://www.ityouknow.com/

3. Start class

@SpringBootApplication
@EnableZuulProxy Public
class Gatewayservicezuulapplication {public

    static void Main (string[] args) {
        springapplication.run (gatewayservicezuulapplication.class, args);
    }
}

The start class adds @enablezuulproxy to support gateway routing.

4. Test
Start Gateway-service-zuul-simple project, access in browser: Http://localhost:8888/it/spring-cloud, see page returned: http://www.ityouknow.com /spring-cloud the information for the page.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.