Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
31a3ff61
Commit
31a3ff61
authored
Jun 01, 2017
by
Biju Kunjummen
Committed by
Spencer Gibb
Jun 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GH-1916: Spring Boot Auto-configuration based Zuul Server and Proxy (#1951)
parent
3773047a
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
246 additions
and
18 deletions
+246
-18
EnableZuulProxy.java
...g/springframework/cloud/netflix/zuul/EnableZuulProxy.java
+3
-2
EnableZuulServer.java
.../springframework/cloud/netflix/zuul/EnableZuulServer.java
+3
-2
ZuulProxyAutoConfiguration.java
...mework/cloud/netflix/zuul/ZuulProxyAutoConfiguration.java
+7
-3
ZuulProxyMarkerConfiguration.java
...work/cloud/netflix/zuul/ZuulProxyMarkerConfiguration.java
+39
-0
ZuulServerAutoConfiguration.java
...ework/cloud/netflix/zuul/ZuulServerAutoConfiguration.java
+3
-2
ZuulServerMarkerConfiguration.java
...ork/cloud/netflix/zuul/ZuulServerMarkerConfiguration.java
+39
-0
spring.factories
...netflix-core/src/main/resources/META-INF/spring.factories
+3
-1
ZuulProxyAutoConfigurationTests.java
...k/cloud/netflix/zuul/ZuulProxyAutoConfigurationTests.java
+62
-0
ZuulProxyConfigurationTests.java
...ework/cloud/netflix/zuul/ZuulProxyConfigurationTests.java
+4
-2
ZuulServerAutoConfigurationTests.java
.../cloud/netflix/zuul/ZuulServerAutoConfigurationTests.java
+62
-0
CustomHostRoutingFilterTests.java
...ud/netflix/zuul/filters/CustomHostRoutingFilterTests.java
+17
-3
ZuulEmptyMetricsApplicationTests.java
...etflix/zuul/metrics/ZuulEmptyMetricsApplicationTests.java
+4
-3
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/EnableZuulProxy.java
View file @
31a3ff61
/*
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -34,11 +34,12 @@ import org.springframework.context.annotation.Import;
...
@@ -34,11 +34,12 @@ import org.springframework.context.annotation.Import;
*
*
* @author Spencer Gibb
* @author Spencer Gibb
* @author Dave Syer
* @author Dave Syer
* @author Biju Kunjummen
*/
*/
@EnableCircuitBreaker
@EnableCircuitBreaker
@EnableDiscoveryClient
@EnableDiscoveryClient
@Target
(
ElementType
.
TYPE
)
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Import
(
ZuulProxyConfiguration
.
class
)
@Import
(
ZuulProxy
Marker
Configuration
.
class
)
public
@interface
EnableZuulProxy
{
public
@interface
EnableZuulProxy
{
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/EnableZuulServer.java
View file @
31a3ff61
/*
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -33,11 +33,12 @@ import org.springframework.context.annotation.Import;
...
@@ -33,11 +33,12 @@ import org.springframework.context.annotation.Import;
* @see EnableZuulProxy to see how to get reverse proxy out of the box
* @see EnableZuulProxy to see how to get reverse proxy out of the box
*
*
* @author Spencer Gibb
* @author Spencer Gibb
* @author Biju Kunjummen
*/
*/
@Target
(
ElementType
.
TYPE
)
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Documented
@Import
(
ZuulConfiguration
.
class
)
@Import
(
Zuul
ServerMarker
Configuration
.
class
)
public
@interface
EnableZuulServer
{
public
@interface
EnableZuulServer
{
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulProxyConfiguration.java
→
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulProxy
Auto
Configuration.java
View file @
31a3ff61
/*
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -22,6 +22,7 @@ import java.util.List;
...
@@ -22,6 +22,7 @@ import java.util.List;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.trace.TraceRepository
;
import
org.springframework.boot.actuate.trace.TraceRepository
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass
;
...
@@ -53,12 +54,14 @@ import org.springframework.context.annotation.Import;
...
@@ -53,12 +54,14 @@ import org.springframework.context.annotation.Import;
/**
/**
* @author Spencer Gibb
* @author Spencer Gibb
* @author Dave Syer
* @author Dave Syer
* @author Biju Kunjummen
*/
*/
@Configuration
@Configuration
@Import
({
RibbonCommandFactoryConfiguration
.
RestClientRibbonConfiguration
.
class
,
@Import
({
RibbonCommandFactoryConfiguration
.
RestClientRibbonConfiguration
.
class
,
RibbonCommandFactoryConfiguration
.
OkHttpRibbonConfiguration
.
class
,
RibbonCommandFactoryConfiguration
.
OkHttpRibbonConfiguration
.
class
,
RibbonCommandFactoryConfiguration
.
HttpClientRibbonConfiguration
.
class
})
RibbonCommandFactoryConfiguration
.
HttpClientRibbonConfiguration
.
class
})
public
class
ZuulProxyConfiguration
extends
ZuulConfiguration
{
@ConditionalOnBean
(
ZuulProxyMarkerConfiguration
.
Marker
.
class
)
public
class
ZuulProxyAutoConfiguration
extends
ZuulServerAutoConfiguration
{
@SuppressWarnings
(
"rawtypes"
)
@SuppressWarnings
(
"rawtypes"
)
@Autowired
(
required
=
false
)
@Autowired
(
required
=
false
)
...
@@ -72,7 +75,7 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
...
@@ -72,7 +75,7 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
@Override
@Override
public
HasFeatures
zuulFeature
()
{
public
HasFeatures
zuulFeature
()
{
return
HasFeatures
.
namedFeature
(
"Zuul (Discovery)"
,
ZuulProxyConfiguration
.
class
);
return
HasFeatures
.
namedFeature
(
"Zuul (Discovery)"
,
ZuulProxy
Auto
Configuration
.
class
);
}
}
@Bean
@Bean
...
@@ -98,6 +101,7 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
...
@@ -98,6 +101,7 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
}
}
@Bean
@Bean
@ConditionalOnMissingBean
(
SimpleHostRoutingFilter
.
class
)
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
(
ProxyRequestHelper
helper
,
ZuulProperties
zuulProperties
)
{
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
(
ProxyRequestHelper
helper
,
ZuulProperties
zuulProperties
)
{
return
new
SimpleHostRoutingFilter
(
helper
,
zuulProperties
);
return
new
SimpleHostRoutingFilter
(
helper
,
zuulProperties
);
}
}
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulProxyMarkerConfiguration.java
0 → 100644
View file @
31a3ff61
/*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* Responsible for adding in a marker bean to trigger activation of
* {@link ZuulServerAutoConfiguration}
*
* @author Biju Kunjummen
*/
@Configuration
public
class
ZuulProxyMarkerConfiguration
{
@Bean
public
Marker
zuulProxyMarkerBean
()
{
return
new
Marker
();
}
class
Marker
{
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulConfiguration.java
→
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/Zuul
ServerAuto
Configuration.java
View file @
31a3ff61
...
@@ -74,9 +74,10 @@ import com.netflix.zuul.monitoring.TracerFactory;
...
@@ -74,9 +74,10 @@ import com.netflix.zuul.monitoring.TracerFactory;
@Configuration
@Configuration
@EnableConfigurationProperties
({
ZuulProperties
.
class
})
@EnableConfigurationProperties
({
ZuulProperties
.
class
})
@ConditionalOnClass
(
ZuulServlet
.
class
)
@ConditionalOnClass
(
ZuulServlet
.
class
)
@ConditionalOnBean
(
ZuulServerMarkerConfiguration
.
Marker
.
class
)
// Make sure to get the ServerProperties from the same place as a normal web app would
// Make sure to get the ServerProperties from the same place as a normal web app would
@Import
(
ServerPropertiesAutoConfiguration
.
class
)
@Import
(
ServerPropertiesAutoConfiguration
.
class
)
public
class
ZuulConfiguration
{
public
class
Zuul
ServerAuto
Configuration
{
@Autowired
@Autowired
protected
ZuulProperties
zuulProperties
;
protected
ZuulProperties
zuulProperties
;
...
@@ -89,7 +90,7 @@ public class ZuulConfiguration {
...
@@ -89,7 +90,7 @@ public class ZuulConfiguration {
@Bean
@Bean
public
HasFeatures
zuulFeature
()
{
public
HasFeatures
zuulFeature
()
{
return
HasFeatures
.
namedFeature
(
"Zuul (Simple)"
,
ZuulConfiguration
.
class
);
return
HasFeatures
.
namedFeature
(
"Zuul (Simple)"
,
Zuul
ServerAuto
Configuration
.
class
);
}
}
@Bean
@Bean
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulServerMarkerConfiguration.java
0 → 100644
View file @
31a3ff61
/*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* Responsible for adding in a marker bean to trigger activation of
* {@link ZuulServerAutoConfiguration}
*
* @author Biju Kunjummen
*/
@Configuration
public
class
ZuulServerMarkerConfiguration
{
@Bean
public
Marker
zuulServerMarkerBean
()
{
return
new
Marker
();
}
class
Marker
{
}
}
spring-cloud-netflix-core/src/main/resources/META-INF/spring.factories
View file @
31a3ff61
...
@@ -8,7 +8,9 @@ org.springframework.cloud.netflix.hystrix.HystrixAutoConfiguration,\
...
@@ -8,7 +8,9 @@ org.springframework.cloud.netflix.hystrix.HystrixAutoConfiguration,\
org.springframework.cloud.netflix.hystrix.security.HystrixSecurityAutoConfiguration,\
org.springframework.cloud.netflix.hystrix.security.HystrixSecurityAutoConfiguration,\
org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration,\
org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration,\
org.springframework.cloud.netflix.rx.RxJavaAutoConfiguration,\
org.springframework.cloud.netflix.rx.RxJavaAutoConfiguration,\
org.springframework.cloud.netflix.metrics.servo.ServoMetricsAutoConfiguration
org.springframework.cloud.netflix.metrics.servo.ServoMetricsAutoConfiguration,\
org.springframework.cloud.netflix.zuul.ZuulServerAutoConfiguration,\
org.springframework.cloud.netflix.zuul.ZuulProxyAutoConfiguration
org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker=\
org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker=\
org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration
org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ZuulProxyAutoConfigurationTests.java
0 → 100644
View file @
31a3ff61
/*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.cloud.netflix.zuul.filters.CompositeRouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* To test the auto-configuration of Zuul Proxy
*
* @author Biju Kunjummen
*
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
ZuulProxyAutoConfigurationTests
{
@Autowired
private
RouteLocator
routeLocator
;
@Autowired
(
required
=
false
)
private
RibbonRoutingFilter
ribbonRoutingFilter
;
@Test
public
void
testAutoConfiguredBeans
()
{
assertThat
(
routeLocator
).
isInstanceOf
(
CompositeRouteLocator
.
class
);
assertThat
(
this
.
ribbonRoutingFilter
).
isNotNull
();
}
@Configuration
@EnableAutoConfiguration
@EnableZuulProxy
static
class
TestConfig
{
}
}
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ZuulProxyConfigurationTests.java
View file @
31a3ff61
/*
/*
* Copyright 2013-201
6
the original author or authors.
* Copyright 2013-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Bean;
...
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Bean;
/**
/**
* @author Spencer Gibb
* @author Spencer Gibb
* @author Biju Kunjummen
*/
*/
public
class
ZuulProxyConfigurationTests
{
public
class
ZuulProxyConfigurationTests
{
...
@@ -60,7 +61,8 @@ public class ZuulProxyConfigurationTests {
...
@@ -60,7 +61,8 @@ public class ZuulProxyConfigurationTests {
void
testClient
(
Class
<?>
clientType
,
String
property
)
{
void
testClient
(
Class
<?>
clientType
,
String
property
)
{
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
context
.
register
(
TestConfig
.
class
,
ZuulProxyConfiguration
.
class
);
context
.
register
(
TestConfig
.
class
,
ZuulProxyMarkerConfiguration
.
class
,
ZuulProxyAutoConfiguration
.
class
);
if
(
property
!=
null
)
{
if
(
property
!=
null
)
{
EnvironmentTestUtils
.
addEnvironment
(
context
,
property
);
EnvironmentTestUtils
.
addEnvironment
(
context
,
property
);
}
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ZuulServerAutoConfigurationTests.java
0 → 100644
View file @
31a3ff61
/*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.cloud.netflix.zuul.filters.CompositeRouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* To test the auto-configuration of Zuul Proxy
*
* @author Biju Kunjummen
*
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
ZuulServerAutoConfigurationTests
{
@Autowired
private
RouteLocator
routeLocator
;
@Autowired
(
required
=
false
)
private
RibbonRoutingFilter
ribbonRoutingFilter
;
@Test
public
void
testAutoConfiguredBeans
()
{
assertThat
(
routeLocator
).
isInstanceOf
(
CompositeRouteLocator
.
class
);
assertThat
(
ribbonRoutingFilter
).
isNull
();
}
@Configuration
@EnableAutoConfiguration
@EnableZuulServer
static
class
TestConfig
{
}
}
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/CustomHostRoutingFilterTests.java
View file @
31a3ff61
/*
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
zuul
.
filters
;
package
org
.
springframework
.
cloud
.
netflix
.
zuul
.
filters
;
import
static
junit
.
framework
.
TestCase
.
assertFalse
;
import
static
junit
.
framework
.
TestCase
.
assertFalse
;
...
@@ -24,7 +40,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
...
@@ -24,7 +40,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
import
org.springframework.cloud.netflix.zuul.RoutesMvcEndpoint
;
import
org.springframework.cloud.netflix.zuul.RoutesMvcEndpoint
;
import
org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration
;
import
org.springframework.cloud.netflix.zuul.filters.discovery.DiscoveryClientRouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.discovery.DiscoveryClientRouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter
;
import
org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -186,10 +201,9 @@ class SampleCustomZuulProxyApplication {
...
@@ -186,10 +201,9 @@ class SampleCustomZuulProxyApplication {
@Configuration
@Configuration
@EnableZuulProxy
@EnableZuulProxy
protected
static
class
CustomZuulProxyConfig
extends
ZuulProxyConfiguration
{
protected
static
class
CustomZuulProxyConfig
{
@Bean
@Bean
@Override
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
(
ProxyRequestHelper
helper
,
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
(
ProxyRequestHelper
helper
,
ZuulProperties
zuulProperties
)
{
ZuulProperties
zuulProperties
)
{
return
new
CustomHostRoutingFilter
(
helper
,
zuulProperties
);
return
new
CustomHostRoutingFilter
(
helper
,
zuulProperties
);
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/metrics/ZuulEmptyMetricsApplicationTests.java
View file @
31a3ff61
/*
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -18,7 +18,8 @@ package org.springframework.cloud.netflix.zuul.metrics;
...
@@ -18,7 +18,8 @@ package org.springframework.cloud.netflix.zuul.metrics;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.cloud.ClassPathExclusions
;
import
org.springframework.cloud.ClassPathExclusions
;
import
org.springframework.cloud.netflix.zuul.ZuulConfiguration
;
import
org.springframework.cloud.netflix.zuul.ZuulServerAutoConfiguration
;
import
org.springframework.cloud.netflix.zuul.ZuulServerMarkerConfiguration
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -42,7 +43,7 @@ public class ZuulEmptyMetricsApplicationTests {
...
@@ -42,7 +43,7 @@ public class ZuulEmptyMetricsApplicationTests {
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
context
.
register
(
ZuulEmptyMetricsApplicationTestsConfiguration
.
class
,
context
.
register
(
ZuulEmptyMetricsApplicationTestsConfiguration
.
class
,
Zuul
Configuration
.
class
);
ZuulServerMarkerConfiguration
.
class
,
ZuulServerAuto
Configuration
.
class
);
context
.
refresh
();
context
.
refresh
();
this
.
context
=
context
;
this
.
context
=
context
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment