Skip to content

Create Zuul Gateway

Piyush Chaudhari edited this page Aug 19, 2018 · 4 revisions

Create spring boot zuul-gateway project as microservice.
Add below dependencies.

compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client') for service discovery
compile('org.springframework.cloud:spring-cloud-starter-netflix-zuul') for zuul gatway

Refresh zuul-gateway from eclipse or STS based on your development tools.

Set below property on application.properties

spring.application.name = zuul-gateway
server.port=8762

eureka.instance.preferIpAddress=true
eureka.client.registerWithEureka=true
eureka.serviceurl.defaultzone=http://localhost:8761/eureka/

endpoints.restart.enabled=true
endpoints.shutdown.enabled=true
endpoints.health.sensitive=false

zuul.ribbon.eager-load.enabled=true

ribbon.ReadTimeout=600000
ribbon.ConnectTimeout=600000
ribbon.MaxAutoRetries=3
ribbon.MaxAutoRetriesNextServer=3
ribbon.restclient.enabled=true
ribbon.eureka.enabled=true

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=600000

Go to mail class of zuul-gateway ZuulGatewayApplication.java and add @EnableDiscoveryClient and @EnableDiscoveryClient annotation