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
74ff6595
Unverified
Commit
74ff6595
authored
Jun 06, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 2.0.x
parents
72b7ee24
9e180b8b
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
471 additions
and
67 deletions
+471
-67
RetryableFeignLoadBalancer.java
...loud/netflix/feign/ribbon/RetryableFeignLoadBalancer.java
+1
-1
DefaultServerIntrospector.java
...ework/cloud/netflix/ribbon/DefaultServerIntrospector.java
+15
-4
RibbonAutoConfiguration.java
...amework/cloud/netflix/ribbon/RibbonAutoConfiguration.java
+1
-1
ServerIntrospectorProperties.java
...rk/cloud/netflix/ribbon/ServerIntrospectorProperties.java
+32
-0
RetryableRibbonLoadBalancingHttpClient.java
...ribbon/apache/RetryableRibbonLoadBalancingHttpClient.java
+1
-1
RetryableOkHttpLoadBalancingClient.java
...lix/ribbon/okhttp/RetryableOkHttpLoadBalancingClient.java
+1
-1
RetryableStatusCodeException.java
.../netflix/ribbon/support/RetryableStatusCodeException.java
+3
-0
EnableZuulProxy.java
...g/springframework/cloud/netflix/zuul/EnableZuulProxy.java
+3
-2
EnableZuulServer.java
.../springframework/cloud/netflix/zuul/EnableZuulServer.java
+3
-2
ZuulFilterInitializer.java
...ngframework/cloud/netflix/zuul/ZuulFilterInitializer.java
+9
-10
ZuulProxyAutoConfiguration.java
...mework/cloud/netflix/zuul/ZuulProxyAutoConfiguration.java
+6
-2
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
ZuulProperties.java
...gframework/cloud/netflix/zuul/filters/ZuulProperties.java
+8
-0
SimpleHostRoutingFilter.java
...d/netflix/zuul/filters/route/SimpleHostRoutingFilter.java
+17
-19
spring.factories
...netflix-core/src/main/resources/META-INF/spring.factories
+3
-1
DefaultServerIntrospectorDefaultTest.java
.../netflix/ribbon/DefaultServerIntrospectorDefaultTest.java
+63
-0
DefaultServerIntrospectorTest.java
...k/cloud/netflix/ribbon/DefaultServerIntrospectorTest.java
+65
-0
ZuulFilterInitializerTests.java
...mework/cloud/netflix/zuul/ZuulFilterInitializerTests.java
+4
-11
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
+1
-3
SimpleHostRoutingFilterTests.java
...flix/zuul/filters/route/SimpleHostRoutingFilterTests.java
+23
-3
ZuulEmptyMetricsApplicationTests.java
...etflix/zuul/metrics/ZuulEmptyMetricsApplicationTests.java
+3
-2
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/RetryableFeignLoadBalancer.java
View file @
74ff6595
...
...
@@ -26,10 +26,10 @@ import org.springframework.cloud.client.ServiceInstance;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryContext
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryPolicy
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryPolicyFactory
;
import
org.springframework.cloud.client.loadbalancer.RetryableStatusCodeException
;
import
org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser
;
import
org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient
;
import
org.springframework.cloud.netflix.ribbon.ServerIntrospector
;
import
org.springframework.cloud.netflix.ribbon.support.RetryableStatusCodeException
;
import
org.springframework.retry.RetryCallback
;
import
org.springframework.retry.RetryContext
;
import
org.springframework.retry.policy.NeverRetryPolicy
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/DefaultServerIntrospector.java
View file @
74ff6595
...
...
@@ -16,19 +16,30 @@
package
org
.
springframework
.
cloud
.
netflix
.
ribbon
;
import
com.netflix.loadbalancer.Server
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
com.netflix.loadbalancer.Server
;
/**
* @author Spencer Gibb
*/
public
class
DefaultServerIntrospector
implements
ServerIntrospector
{
private
ServerIntrospectorProperties
serverIntrospectorProperties
=
new
ServerIntrospectorProperties
();
@Autowired
(
required
=
false
)
public
void
setServerIntrospectorProperties
(
ServerIntrospectorProperties
serverIntrospectorProperties
){
this
.
serverIntrospectorProperties
=
serverIntrospectorProperties
;
}
@Override
public
boolean
isSecure
(
Server
server
)
{
// Can we do better?
return
(
""
+
server
.
getPort
()).
endsWith
(
"443"
);
return
serverIntrospectorProperties
.
getSecurePorts
().
contains
(
server
.
getPort
());
}
@Override
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonAutoConfiguration.java
View file @
74ff6595
...
...
@@ -61,7 +61,7 @@ import com.netflix.ribbon.Ribbon;
@RibbonClients
@AutoConfigureAfter
(
name
=
"org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration"
)
@AutoConfigureBefore
({
LoadBalancerAutoConfiguration
.
class
,
AsyncLoadBalancerAutoConfiguration
.
class
})
@EnableConfigurationProperties
(
RibbonEagerLoadProperties
.
class
)
@EnableConfigurationProperties
(
{
RibbonEagerLoadProperties
.
class
,
ServerIntrospectorProperties
.
class
}
)
public
class
RibbonAutoConfiguration
{
@Autowired
(
required
=
false
)
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/ServerIntrospectorProperties.java
0 → 100644
View file @
74ff6595
/*
* Copyright 2013-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
.
ribbon
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author Rico Pahlisch
*/
@Data
@ConfigurationProperties
(
"ribbon"
)
public
class
ServerIntrospectorProperties
{
private
List
<
Integer
>
securePorts
=
Arrays
.
asList
(
443
,
8443
);
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/apache/RetryableRibbonLoadBalancingHttpClient.java
View file @
74ff6595
...
...
@@ -25,11 +25,11 @@ import org.springframework.cloud.client.ServiceInstance;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryContext
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryPolicy
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryPolicyFactory
;
import
org.springframework.cloud.client.loadbalancer.RetryableStatusCodeException
;
import
org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser
;
import
org.springframework.cloud.netflix.feign.ribbon.FeignRetryPolicy
;
import
org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient
;
import
org.springframework.cloud.netflix.ribbon.ServerIntrospector
;
import
org.springframework.cloud.netflix.ribbon.support.RetryableStatusCodeException
;
import
org.springframework.http.HttpRequest
;
import
org.springframework.retry.RetryCallback
;
import
org.springframework.retry.RetryContext
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/okhttp/RetryableOkHttpLoadBalancingClient.java
View file @
74ff6595
...
...
@@ -25,11 +25,11 @@ import org.springframework.cloud.client.ServiceInstance;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryContext
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryPolicy
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancedRetryPolicyFactory
;
import
org.springframework.cloud.client.loadbalancer.RetryableStatusCodeException
;
import
org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser
;
import
org.springframework.cloud.netflix.feign.ribbon.FeignRetryPolicy
;
import
org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient
;
import
org.springframework.cloud.netflix.ribbon.ServerIntrospector
;
import
org.springframework.cloud.netflix.ribbon.support.RetryableStatusCodeException
;
import
org.springframework.http.HttpRequest
;
import
org.springframework.retry.RetryCallback
;
import
org.springframework.retry.RetryContext
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/support/RetryableStatusCodeException.java
View file @
74ff6595
...
...
@@ -23,7 +23,10 @@ import java.io.IOException;
/**
* Exception to be thrown when the status code is deemed to be retryable.
* @author Ryan Baxter
* @deprecated Use {@link org.springframework.cloud.client.loadbalancer.RetryableStatusCodeException} instead
*/
//TODO Remove in Edgeware
@Deprecated
public
class
RetryableStatusCodeException
extends
IOException
{
private
static
final
String
MESSAGE
=
"Service %s returned a status code of %d"
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/EnableZuulProxy.java
View file @
74ff6595
/*
* 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");
* you may not use this file except in compliance with the License.
...
...
@@ -34,11 +34,12 @@ import org.springframework.context.annotation.Import;
*
* @author Spencer Gibb
* @author Dave Syer
* @author Biju Kunjummen
*/
@EnableCircuitBreaker
@EnableDiscoveryClient
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Import
(
ZuulProxyConfiguration
.
class
)
@Import
(
ZuulProxy
Marker
Configuration
.
class
)
public
@interface
EnableZuulProxy
{
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/EnableZuulServer.java
View file @
74ff6595
/*
* 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");
* you may not use this file except in compliance with the License.
...
...
@@ -33,11 +33,12 @@ import org.springframework.context.annotation.Import;
* @see EnableZuulProxy to see how to get reverse proxy out of the box
*
* @author Spencer Gibb
* @author Biju Kunjummen
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Import
(
ZuulConfiguration
.
class
)
@Import
(
Zuul
ServerMarker
Configuration
.
class
)
public
@interface
EnableZuulServer
{
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulFilterInitializer.java
View file @
74ff6595
...
...
@@ -19,8 +19,8 @@ package org.springframework.cloud.netflix.zuul;
import
java.lang.reflect.Field
;
import
java.util.Map
;
import
javax.
servlet.ServletContextEven
t
;
import
javax.
servlet.ServletContextListener
;
import
javax.
annotation.PostConstruc
t
;
import
javax.
annotation.PreDestroy
;
import
org.springframework.util.ReflectionUtils
;
...
...
@@ -39,7 +39,7 @@ import lombok.extern.apachecommons.CommonsLog;
*
*/
@CommonsLog
public
class
ZuulFilterInitializer
implements
ServletContextListener
{
public
class
ZuulFilterInitializer
{
private
final
Map
<
String
,
ZuulFilter
>
filters
;
private
final
CounterFactory
counterFactory
;
...
...
@@ -59,10 +59,9 @@ public class ZuulFilterInitializer implements ServletContextListener {
this
.
filterRegistry
=
filterRegistry
;
}
@Override
public
void
contextInitialized
(
ServletContextEvent
sce
)
{
log
.
info
(
"Starting filter initializer context listener"
);
@PostConstruct
public
void
contextInitialized
()
{
log
.
info
(
"Starting filter initializer"
);
TracerFactory
.
initialize
(
tracerFactory
);
CounterFactory
.
initialize
(
counterFactory
);
...
...
@@ -72,9 +71,9 @@ public class ZuulFilterInitializer implements ServletContextListener {
}
}
@
Override
public
void
contextDestroyed
(
ServletContextEvent
sce
)
{
log
.
info
(
"Stopping filter initializer
context listener
"
);
@
PreDestroy
public
void
contextDestroyed
()
{
log
.
info
(
"Stopping filter initializer"
);
for
(
Map
.
Entry
<
String
,
ZuulFilter
>
entry
:
this
.
filters
.
entrySet
())
{
filterRegistry
.
remove
(
entry
.
getKey
());
}
...
...
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 @
74ff6595
...
...
@@ -23,6 +23,7 @@ import java.util.List;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
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.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass
;
...
...
@@ -54,12 +55,14 @@ import org.springframework.context.annotation.Import;
/**
* @author Spencer Gibb
* @author Dave Syer
* @author Biju Kunjummen
*/
@Configuration
@Import
({
RibbonCommandFactoryConfiguration
.
RestClientRibbonConfiguration
.
class
,
RibbonCommandFactoryConfiguration
.
OkHttpRibbonConfiguration
.
class
,
RibbonCommandFactoryConfiguration
.
HttpClientRibbonConfiguration
.
class
})
public
class
ZuulProxyConfiguration
extends
ZuulConfiguration
{
@ConditionalOnBean
(
ZuulProxyMarkerConfiguration
.
Marker
.
class
)
public
class
ZuulProxyAutoConfiguration
extends
ZuulServerAutoConfiguration
{
@SuppressWarnings
(
"rawtypes"
)
@Autowired
(
required
=
false
)
...
...
@@ -73,7 +76,7 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
@Override
public
HasFeatures
zuulFeature
()
{
return
HasFeatures
.
namedFeature
(
"Zuul (Discovery)"
,
ZuulProxyConfiguration
.
class
);
return
HasFeatures
.
namedFeature
(
"Zuul (Discovery)"
,
ZuulProxy
Auto
Configuration
.
class
);
}
@Bean
...
...
@@ -99,6 +102,7 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
}
@Bean
@ConditionalOnMissingBean
(
SimpleHostRoutingFilter
.
class
)
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
(
ProxyRequestHelper
helper
,
ZuulProperties
zuulProperties
)
{
return
new
SimpleHostRoutingFilter
(
helper
,
zuulProperties
);
}
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulProxyMarkerConfiguration.java
0 → 100644
View file @
74ff6595
/*
* 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 @
74ff6595
...
...
@@ -73,9 +73,10 @@ import com.netflix.zuul.monitoring.TracerFactory;
@Configuration
@EnableConfigurationProperties
({
ZuulProperties
.
class
})
@ConditionalOnClass
(
ZuulServlet
.
class
)
@ConditionalOnBean
(
ZuulServerMarkerConfiguration
.
Marker
.
class
)
// Make sure to get the ServerProperties from the same place as a normal web app would
// FIXME @Import(ServerPropertiesAutoConfiguration.class)
public
class
ZuulConfiguration
{
public
class
Zuul
ServerAuto
Configuration
{
@Autowired
protected
ZuulProperties
zuulProperties
;
...
...
@@ -88,7 +89,7 @@ public class ZuulConfiguration {
@Bean
public
HasFeatures
zuulFeature
()
{
return
HasFeatures
.
namedFeature
(
"Zuul (Simple)"
,
ZuulConfiguration
.
class
);
return
HasFeatures
.
namedFeature
(
"Zuul (Simple)"
,
Zuul
ServerAuto
Configuration
.
class
);
}
@Bean
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulServerMarkerConfiguration.java
0 → 100644
View file @
74ff6595
/*
* 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/java/org/springframework/cloud/netflix/zuul/filters/ZuulProperties.java
View file @
74ff6595
...
...
@@ -329,6 +329,14 @@ public class ZuulProperties {
*/
private
int
maxPerRouteConnections
=
20
;
/**
* The socket timeout in millis. Defaults to 10000.
*/
private
int
socketTimeoutMillis
=
10000
;
/**
* The connection timeout in millis. Defaults to 2000.
*/
private
int
connectTimeoutMillis
=
2000
;
/**
* The lifetime for the connection pool.
*/
private
long
timeToLive
=
-
1
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java
View file @
74ff6595
...
...
@@ -67,18 +67,17 @@ import org.apache.http.message.BasicHeader;
import
org.apache.http.message.BasicHttpEntityEnclosingRequest
;
import
org.apache.http.message.BasicHttpRequest
;
import
org.apache.http.protocol.HttpContext
;
import
org.springframework.cloud.context.environment.EnvironmentChangeEvent
;
import
org.springframework.cloud.netflix.zuul.filters.ProxyRequestHelper
;
import
org.springframework.cloud.netflix.zuul.filters.ZuulProperties
;
import
org.springframework.cloud.netflix.zuul.filters.ZuulProperties.Host
;
import
org.springframework.cloud.netflix.zuul.util.ZuulRuntimeException
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.StringUtils
;
import
com.netflix.config.DynamicIntProperty
;
import
com.netflix.config.DynamicPropertyFactory
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.constants.ZuulConstants
;
import
com.netflix.zuul.context.RequestContext
;
import
static
org
.
springframework
.
cloud
.
netflix
.
zuul
.
filters
.
support
.
FilterConstants
.
HTTPS_SCHEME
;
...
...
@@ -98,14 +97,6 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
private
static
final
Log
log
=
LogFactory
.
getLog
(
SimpleHostRoutingFilter
.
class
);
private
static
final
DynamicIntProperty
SOCKET_TIMEOUT
=
DynamicPropertyFactory
.
getInstance
()
.
getIntProperty
(
ZuulConstants
.
ZUUL_HOST_SOCKET_TIMEOUT_MILLIS
,
10000
);
private
static
final
DynamicIntProperty
CONNECTION_TIMEOUT
=
DynamicPropertyFactory
.
getInstance
()
.
getIntProperty
(
ZuulConstants
.
ZUUL_HOST_CONNECT_TIMEOUT_MILLIS
,
2000
);
private
final
Timer
connectionManagerTimer
=
new
Timer
(
"SimpleHostRoutingFilter.connectionManagerTimer"
,
true
);
...
...
@@ -117,9 +108,18 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
private
PoolingHttpClientConnectionManager
connectionManager
;
private
CloseableHttpClient
httpClient
;
private
final
Runnable
clientloader
=
new
Runnable
()
{
@Override
public
void
run
()
{
@EventListener
public
void
onPropertyChange
(
EnvironmentChangeEvent
event
)
{
boolean
createNewClient
=
false
;
for
(
String
key
:
event
.
getKeys
())
{
if
(
key
.
startsWith
(
"zuul.host."
))
{
createNewClient
=
true
;
break
;
}
}
if
(
createNewClient
)
{
try
{
SimpleHostRoutingFilter
.
this
.
httpClient
.
close
();
}
...
...
@@ -128,7 +128,7 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
}
SimpleHostRoutingFilter
.
this
.
httpClient
=
newClient
();
}
}
;
}
public
SimpleHostRoutingFilter
(
ProxyRequestHelper
helper
,
ZuulProperties
properties
)
{
this
.
helper
=
helper
;
...
...
@@ -141,8 +141,6 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
@PostConstruct
private
void
initialize
()
{
this
.
httpClient
=
newClient
();
SOCKET_TIMEOUT
.
addCallback
(
this
.
clientloader
);
CONNECTION_TIMEOUT
.
addCallback
(
this
.
clientloader
);
this
.
connectionManagerTimer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
...
...
@@ -251,8 +249,8 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
protected
CloseableHttpClient
newClient
()
{
final
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setSocketTimeout
(
SOCKET_TIMEOUT
.
get
())
.
setConnectTimeout
(
CONNECTION_TIMEOUT
.
get
())
.
setSocketTimeout
(
this
.
hostProperties
.
getSocketTimeoutMillis
())
.
setConnectTimeout
(
this
.
hostProperties
.
getConnectTimeoutMillis
())
.
setCookieSpec
(
CookieSpecs
.
IGNORE_COOKIES
).
build
();
HttpClientBuilder
httpClientBuilder
=
HttpClients
.
custom
();
...
...
spring-cloud-netflix-core/src/main/resources/META-INF/spring.factories
View file @
74ff6595
...
...
@@ -8,7 +8,9 @@ org.springframework.cloud.netflix.hystrix.HystrixAutoConfiguration,\
org.springframework.cloud.netflix.hystrix.security.HystrixSecurityAutoConfiguration,\
org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration,\
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.netflix.hystrix.HystrixCircuitBreakerConfiguration
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/DefaultServerIntrospectorDefaultTest.java
0 → 100644
View file @
74ff6595
/*
* Copyright 2013-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
.
ribbon
;
import
com.netflix.loadbalancer.Server
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
/**
* @author Rico Pahlisch
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
DefaultServerIntrospectorDefaultTest
.
TestConfiguration
.
class
)
public
class
DefaultServerIntrospectorDefaultTest
{
@Autowired
private
ServerIntrospector
serverIntrospector
;
@Test
public
void
testDefaultSslPorts
(){
Server
serverMock
=
mock
(
Server
.
class
);
when
(
serverMock
.
getPort
()).
thenReturn
(
443
);
Assert
.
assertTrue
(
serverIntrospector
.
isSecure
(
serverMock
));
when
(
serverMock
.
getPort
()).
thenReturn
(
8443
);
Assert
.
assertTrue
(
serverIntrospector
.
isSecure
(
serverMock
));
when
(
serverMock
.
getPort
()).
thenReturn
(
16443
);
Assert
.
assertFalse
(
serverIntrospector
.
isSecure
(
serverMock
));
}
@Configuration
@EnableConfigurationProperties
(
ServerIntrospectorProperties
.
class
)
protected
static
class
TestConfiguration
{
@Bean
public
DefaultServerIntrospector
defaultServerIntrospector
(){
return
new
DefaultServerIntrospector
();
}
}
}
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/DefaultServerIntrospectorTest.java
0 → 100644
View file @
74ff6595
/*
* Copyright 2013-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
.
ribbon
;
import
com.netflix.loadbalancer.Server
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.context.TestPropertySource
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
/**
* @author Rico Pahlisch
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
DefaultServerIntrospectorTest
.
TestConfiguration
.
class
)
@TestPropertySource
(
properties
=
{
"ribbon.securePorts=12345,556"
})
public
class
DefaultServerIntrospectorTest
{
@Autowired
private
ServerIntrospector
serverIntrospector
;
@Test
public
void
testSecurePortConfiguration
(){
Server
serverMock
=
mock
(
Server
.
class
);
when
(
serverMock
.
getPort
()).
thenReturn
(
12345
);
Assert
.
assertTrue
(
serverIntrospector
.
isSecure
(
serverMock
));
when
(
serverMock
.
getPort
()).
thenReturn
(
556
);
Assert
.
assertTrue
(
serverIntrospector
.
isSecure
(
serverMock
));
when
(
serverMock
.
getPort
()).
thenReturn
(
443
);
Assert
.
assertFalse
(
serverIntrospector
.
isSecure
(
serverMock
));
}
@Configuration
@EnableConfigurationProperties
(
ServerIntrospectorProperties
.
class
)
protected
static
class
TestConfiguration
{
@Bean
public
DefaultServerIntrospector
defaultServerIntrospector
(){
return
new
DefaultServerIntrospector
();
}
}
}
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ZuulFilterInitializerTests.java
View file @
74ff6595
...
...
@@ -16,12 +16,12 @@
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.servlet.ServletContextEvent
;
import
org.junit.Test
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
org.springframework.util.ReflectionUtils
;
...
...
@@ -31,10 +31,6 @@ import com.netflix.zuul.filters.FilterRegistry;
import
com.netflix.zuul.monitoring.CounterFactory
;
import
com.netflix.zuul.monitoring.TracerFactory
;
import
org.junit.Test
;
import
java.lang.reflect.Constructor
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
...
...
@@ -42,9 +38,6 @@ import static org.mockito.Mockito.mock;
public
class
ZuulFilterInitializerTests
{
private
static
final
ServletContextEvent
DUMMY_SERVLET_CONTEXT_EVENT
=
mock
(
ServletContextEvent
.
class
);
private
Map
<
String
,
ZuulFilter
>
filters
=
getFilters
();
private
CounterFactory
counterFactory
=
mock
(
CounterFactory
.
class
);
private
TracerFactory
tracerFactory
=
mock
(
TracerFactory
.
class
);
...
...
@@ -56,7 +49,7 @@ public class ZuulFilterInitializerTests {
@Test
public
void
shouldSetupOnContextInitializedEvent
()
throws
Exception
{
initializer
.
contextInitialized
(
DUMMY_SERVLET_CONTEXT_EVENT
);
initializer
.
contextInitialized
();
assertEquals
(
tracerFactory
,
TracerFactory
.
instance
());
assertEquals
(
counterFactory
,
CounterFactory
.
instance
());
...
...
@@ -66,7 +59,7 @@ public class ZuulFilterInitializerTests {
@Test
public
void
shouldCleanupOnContextDestroyed
()
throws
Exception
{
initializer
.
contextDestroyed
(
DUMMY_SERVLET_CONTEXT_EVENT
);
initializer
.
contextDestroyed
();
assertEquals
(
null
,
ReflectionTestUtils
.
getField
(
TracerFactory
.
class
,
"INSTANCE"
));
assertEquals
(
null
,
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ZuulProxyAutoConfigurationTests.java
0 → 100644
View file @
74ff6595
/*
* 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 @
74ff6595
/*
* 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");
* you may not use this file except in compliance with the License.
...
...
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Bean;
/**
* @author Spencer Gibb
* @author Biju Kunjummen
*/
public
class
ZuulProxyConfigurationTests
{
...
...
@@ -60,7 +61,8 @@ public class ZuulProxyConfigurationTests {
void
testClient
(
Class
<?>
clientType
,
String
property
)
{
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
context
.
register
(
TestConfig
.
class
,
ZuulProxyConfiguration
.
class
);
context
.
register
(
TestConfig
.
class
,
ZuulProxyMarkerConfiguration
.
class
,
ZuulProxyAutoConfiguration
.
class
);
if
(
property
!=
null
)
{
EnvironmentTestUtils
.
addEnvironment
(
context
,
property
);
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ZuulServerAutoConfigurationTests.java
0 → 100644
View file @
74ff6595
/*
* 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 @
74ff6595
...
...
@@ -41,7 +41,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
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.route.SimpleHostRoutingFilter
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -203,10 +202,9 @@ class SampleCustomZuulProxyApplication {
@Configuration
@EnableZuulProxy
protected
static
class
CustomZuulProxyConfig
extends
ZuulProxyConfiguration
{
protected
static
class
CustomZuulProxyConfig
{
@Bean
@Override
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
(
ProxyRequestHelper
helper
,
ZuulProperties
zuulProperties
)
{
return
new
CustomHostRoutingFilter
(
helper
,
zuulProperties
);
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java
View file @
74ff6595
...
...
@@ -23,6 +23,7 @@ import java.io.IOException;
import
java.lang.reflect.Field
;
import
java.nio.charset.Charset
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.concurrent.TimeUnit
;
import
java.util.zip.GZIPOutputStream
;
...
...
@@ -47,6 +48,7 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
import
org.springframework.boot.web.server.LocalServerPort
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.cloud.context.environment.EnvironmentChangeEvent
;
import
org.springframework.cloud.netflix.zuul.filters.ProxyRequestHelper
;
import
org.springframework.cloud.netflix.zuul.filters.ZuulProperties
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
...
...
@@ -55,6 +57,7 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.mock.web.MockHttpServletRequest
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
@@ -77,8 +80,7 @@ import static org.springframework.util.StreamUtils.copyToString;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
SampleApplication
.
class
,
webEnvironment
=
RANDOM_PORT
,
properties
=
{
"server.servlet.contextPath: /app"
,
"zuul.host.socket-timeout-millis=11000"
,
"zuul.host.connect-timeout-millis=2100"
})
properties
=
{
"server.servlet.contextPath: /app"
})
@DirtiesContext
public
class
SimpleHostRoutingFilterTests
{
...
...
@@ -96,6 +98,8 @@ public class SimpleHostRoutingFilterTests {
@Test
public
void
timeoutPropertiesAreApplied
()
{
addEnvironment
(
this
.
context
,
"zuul.host.socket-timeout-millis=11000"
,
"zuul.host.connect-timeout-millis=2100"
);
setupContext
();
CloseableHttpClient
httpClient
=
getFilter
().
newClient
();
Assertions
.
assertThat
(
httpClient
).
isInstanceOf
(
Configurable
.
class
);
...
...
@@ -189,6 +193,17 @@ public class SimpleHostRoutingFilterTests {
assertTrue
(
"Get 1"
.
equals
(
responseString
));
}
@Test
public
void
zuulHostKeysUpdateHttpClient
()
{
setupContext
();
SimpleHostRoutingFilter
filter
=
getFilter
();
CloseableHttpClient
httpClient
=
(
CloseableHttpClient
)
ReflectionTestUtils
.
getField
(
filter
,
"httpClient"
);
EnvironmentChangeEvent
event
=
new
EnvironmentChangeEvent
(
Collections
.
singleton
(
"zuul.host.mykey"
));
filter
.
onPropertyChange
(
event
);
CloseableHttpClient
newhttpClient
=
(
CloseableHttpClient
)
ReflectionTestUtils
.
getField
(
filter
,
"httpClient"
);
Assertions
.
assertThat
(
httpClient
).
isNotEqualTo
(
newhttpClient
);
}
private
void
setupContext
()
{
this
.
context
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
,
TestConfiguration
.
class
);
...
...
@@ -200,9 +215,14 @@ public class SimpleHostRoutingFilterTests {
}
@Configuration
@EnableConfigurationProperties
(
ZuulProperties
.
class
)
@EnableConfigurationProperties
protected
static
class
TestConfiguration
{
@Bean
ZuulProperties
zuulProperties
()
{
return
new
ZuulProperties
();
}
@Bean
SimpleHostRoutingFilter
simpleHostRoutingFilter
(
ZuulProperties
zuulProperties
)
{
return
new
SimpleHostRoutingFilter
(
new
ProxyRequestHelper
(),
zuulProperties
);
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/metrics/ZuulEmptyMetricsApplicationTests.java
View file @
74ff6595
...
...
@@ -19,7 +19,8 @@ package org.springframework.cloud.netflix.zuul.metrics;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.cloud.test.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.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -43,7 +44,7 @@ public class ZuulEmptyMetricsApplicationTests {
public
void
setUp
()
throws
Exception
{
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
context
.
register
(
ZuulEmptyMetricsApplicationTestsConfiguration
.
class
,
Zuul
Configuration
.
class
);
ZuulServerMarkerConfiguration
.
class
,
ZuulServerAuto
Configuration
.
class
);
context
.
refresh
();
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