Application.java
@Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableZuulProxy
public class ZuulServer {
public static void main(String[] args) {
SpringApplication.run(ZuulServer.class, args);
}
}
application.yml
eureka:
client:
enabled: true
serviceUrl:
defaultZone: http://localhost:8761/v2/
zuul:
proxy:
route:
service1: /myservice1
service2: /myservice2
Example calls:
http://localhost:8080/proxy/myservice1/users
http://localhost:8080/proxy/myservice2/auctionlots/today
Predecoration filter works during routing getting following error (using 1.0.0.M2) :
Caused by: java.lang.NoSuchMethodError: com.netflix.hystrix.HystrixExecutableBase$ObservableCommand.toBlocking()Lrx/observables/BlockingObservable;
at com.netflix.hystrix.HystrixExecutableBase.queue(HystrixExecutableBase.java:342)
at com.netflix.hystrix.HystrixObservableCommand.queue(HystrixObservableCommand.java:50)
at com.netflix.hystrix.HystrixExecutableBase.execute(HystrixExecutableBase.java:296)
at com.netflix.hystrix.HystrixObservableCommand.execute(HystrixObservableCommand.java:50)
at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:485)
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:162)
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:86)
at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112)
at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197)
... 41 common frames omitted
@vladsfl My sample app with your provided code works. That particular error comes from having an incompatible version (likely old) of rxjava. The version in my sample (and the version that works with hystrix) is
com.netflix.rxjava:rxjava-core:jar:0.20.6
. Can you provide your configuration? What version of rxjava do you have?