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
5246b932
Commit
5246b932
authored
Dec 03, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove reflection hack
parent
aca1897f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
30 deletions
+1
-30
ConfigurableEnvironmentConfiguration.java
...etflix/archaius/ConfigurableEnvironmentConfiguration.java
+1
-18
ProxyRouteLocator.java
...springframework/cloud/netflix/zuul/ProxyRouteLocator.java
+0
-12
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/archaius/ConfigurableEnvironmentConfiguration.java
View file @
5246b932
package
org
.
springframework
.
cloud
.
netflix
.
archaius
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.commons.configuration.AbstractConfiguration
;
import
org.springframework.core.env.CompositePropertySource
;
...
...
@@ -16,7 +13,6 @@ import org.springframework.core.env.EnumerablePropertySource;
import
org.springframework.core.env.MutablePropertySources
;
import
org.springframework.core.env.PropertySource
;
import
org.springframework.core.env.StandardEnvironment
;
import
org.springframework.util.ReflectionUtils
;
/**
* @author Spencer Gibb
...
...
@@ -82,8 +78,7 @@ public class ConfigurableEnvironmentConfiguration extends AbstractConfiguration
private
void
extract
(
String
root
,
Map
<
String
,
PropertySource
<?>>
map
,
PropertySource
<?>
source
)
{
if
(
source
instanceof
CompositePropertySource
)
{
Set
<
PropertySource
<?>>
nested
=
getNestedPropertySources
((
CompositePropertySource
)
source
);
for
(
PropertySource
<?>
nest
:
nested
)
{
for
(
PropertySource
<?>
nest
:
((
CompositePropertySource
)
source
).
getPropertySources
())
{
extract
(
source
.
getName
()
+
":"
,
map
,
nest
);
}
}
...
...
@@ -92,16 +87,4 @@ public class ConfigurableEnvironmentConfiguration extends AbstractConfiguration
}
}
@SuppressWarnings
(
"unchecked"
)
private
Set
<
PropertySource
<?>>
getNestedPropertySources
(
CompositePropertySource
source
)
{
try
{
Field
field
=
ReflectionUtils
.
findField
(
CompositePropertySource
.
class
,
"propertySources"
);
field
.
setAccessible
(
true
);
return
(
Set
<
PropertySource
<?>>)
field
.
get
(
source
);
}
catch
(
Exception
ex
)
{
return
Collections
.
emptySet
();
}
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ProxyRouteLocator.java
View file @
5246b932
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
java.lang.reflect.Field
;
import
java.util.Collection
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
...
...
@@ -16,10 +15,8 @@ import org.springframework.cloud.client.discovery.DiscoveryClient;
import
org.springframework.cloud.context.environment.EnvironmentChangeEvent
;
import
org.springframework.cloud.netflix.zuul.ZuulProperties.ZuulRoute
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.core.env.CompositePropertySource
;
import
org.springframework.util.AntPathMatcher
;
import
org.springframework.util.PathMatcher
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.StringUtils
;
/**
...
...
@@ -36,8 +33,6 @@ public class ProxyRouteLocator implements ApplicationListener<EnvironmentChangeE
private
PathMatcher
pathMatcher
=
new
AntPathMatcher
();
private
Field
propertySourcesField
;
private
AtomicReference
<
Map
<
String
,
ZuulRoute
>>
routes
=
new
AtomicReference
<>();
private
Map
<
String
,
String
>
staticRoutes
=
new
LinkedHashMap
<
String
,
String
>();
...
...
@@ -45,13 +40,6 @@ public class ProxyRouteLocator implements ApplicationListener<EnvironmentChangeE
public
ProxyRouteLocator
(
DiscoveryClient
discovery
,
ZuulProperties
properties
)
{
this
.
discovery
=
discovery
;
this
.
properties
=
properties
;
initField
();
}
private
void
initField
()
{
propertySourcesField
=
ReflectionUtils
.
findField
(
CompositePropertySource
.
class
,
"propertySources"
);
propertySourcesField
.
setAccessible
(
true
);
}
@Override
...
...
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