Commit d322b0a4 by Johannes Edmeier

Polish RevereseZuulProxyConfiguration

parent d6c97130
...@@ -59,8 +59,11 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration { ...@@ -59,8 +59,11 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration {
@Autowired @Autowired
private AdminServerProperties adminServer; private AdminServerProperties adminServer;
@Autowired @Bean
private ZuulHandlerMapping zuulHandlerMapping; @Primary
public CompositeRouteLocator compositeRouteLocator(List<RouteLocator> locators) {
return new CompositeRouteLocator(locators);
}
@Bean @Bean
@Order(0) @Order(0)
...@@ -72,15 +75,11 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration { ...@@ -72,15 +75,11 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration {
return routeLocator; return routeLocator;
} }
@Bean
@Primary
public CompositeRouteLocator routeLocator(List<RouteLocator> locators) {
return new CompositeRouteLocator(locators);
}
@Override @Override
@Bean
@Order(-100)
public RouteLocator routeLocator() { public RouteLocator routeLocator() {
return null; return super.routeLocator();
} }
@Bean @Bean
...@@ -102,8 +101,8 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration { ...@@ -102,8 +101,8 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration {
// pre filters // pre filters
@Bean @Bean
public PreDecorationFilter preDecorationFilter() { public PreDecorationFilter preDecorationFilter(RouteLocator routeLocator) {
return new PreDecorationFilter(routeLocator(), this.server.getServletPrefix(), return new PreDecorationFilter(routeLocator, this.server.getServletPrefix(),
zuulProperties, proxyRequestHelper()); zuulProperties, proxyRequestHelper());
} }
...@@ -120,7 +119,7 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration { ...@@ -120,7 +119,7 @@ public class RevereseZuulProxyConfiguration extends ZuulConfiguration {
@Bean @Bean
@Override @Override
public ApplicationListener<ApplicationEvent> zuulRefreshRoutesListener() { public ApplicationListener<ApplicationEvent> zuulRefreshRoutesListener() {
return new ZuulRefreshListener(zuulHandlerMapping); return new ZuulRefreshListener(zuulHandlerMapping(null));
} }
@Configuration @Configuration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment