Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apollo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
apollo
Commits
b6aea0c2
Unverified
Commit
b6aea0c2
authored
Sep 02, 2018
by
Jason Song
Committed by
GitHub
Sep 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1432 from nobodyiam/fix-issue-1034
make sure ApolloBootstrapPropertySources is in the first place
parents
737e86f3
5740bcdb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/config/PropertySourcesProcessor.java
...mework/apollo/spring/config/PropertySourcesProcessor.java
+21
-0
No files found.
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/config/PropertySourcesProcessor.java
View file @
b6aea0c2
...
@@ -25,6 +25,8 @@ import org.springframework.core.env.Environment;
...
@@ -25,6 +25,8 @@ import org.springframework.core.env.Environment;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
org.springframework.core.env.MutablePropertySources
;
import
org.springframework.core.env.PropertySource
;
/**
/**
* Apollo Property Sources processor for Spring Annotation Based Application. <br /> <br />
* Apollo Property Sources processor for Spring Annotation Based Application. <br /> <br />
...
@@ -81,6 +83,10 @@ public class PropertySourcesProcessor implements BeanFactoryPostProcessor, Envir
...
@@ -81,6 +83,10 @@ public class PropertySourcesProcessor implements BeanFactoryPostProcessor, Envir
// add after the bootstrap property source or to the first
// add after the bootstrap property source or to the first
if
(
environment
.
getPropertySources
()
if
(
environment
.
getPropertySources
()
.
contains
(
PropertySourcesConstants
.
APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME
))
{
.
contains
(
PropertySourcesConstants
.
APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME
))
{
// ensure ApolloBootstrapPropertySources is still the first
ensureBootstrapPropertyPrecedence
(
environment
);
environment
.
getPropertySources
()
environment
.
getPropertySources
()
.
addAfter
(
PropertySourcesConstants
.
APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME
,
composite
);
.
addAfter
(
PropertySourcesConstants
.
APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME
,
composite
);
}
else
{
}
else
{
...
@@ -88,6 +94,21 @@ public class PropertySourcesProcessor implements BeanFactoryPostProcessor, Envir
...
@@ -88,6 +94,21 @@ public class PropertySourcesProcessor implements BeanFactoryPostProcessor, Envir
}
}
}
}
private
void
ensureBootstrapPropertyPrecedence
(
ConfigurableEnvironment
environment
)
{
MutablePropertySources
propertySources
=
environment
.
getPropertySources
();
PropertySource
<?>
bootstrapPropertySource
=
propertySources
.
get
(
PropertySourcesConstants
.
APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME
);
// not exists or already in the first place
if
(
bootstrapPropertySource
==
null
||
propertySources
.
precedenceOf
(
bootstrapPropertySource
)
==
0
)
{
return
;
}
propertySources
.
remove
(
PropertySourcesConstants
.
APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME
);
propertySources
.
addFirst
(
bootstrapPropertySource
);
}
private
void
initializeAutoUpdatePropertiesFeature
(
ConfigurableListableBeanFactory
beanFactory
)
{
private
void
initializeAutoUpdatePropertiesFeature
(
ConfigurableListableBeanFactory
beanFactory
)
{
if
(!
configUtil
.
isAutoUpdateInjectedSpringPropertiesEnabled
())
{
if
(!
configUtil
.
isAutoUpdateInjectedSpringPropertiesEnabled
())
{
return
;
return
;
...
...
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