Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-parent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
schbrain-parent
Commits
5a58e3d9
Commit
5a58e3d9
authored
Jul 01, 2023
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add implements note for ConfigurablePropertiesLoader#load
parent
792f2539
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/ConfigurablePropertiesLoader.java
...rk/autoconfigure/apollo/ConfigurablePropertiesLoader.java
+8
-5
No files found.
starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/ConfigurablePropertiesLoader.java
View file @
5a58e3d9
...
@@ -39,9 +39,12 @@ class ConfigurablePropertiesLoader {
...
@@ -39,9 +39,12 @@ class ConfigurablePropertiesLoader {
this
.
log
=
deferredLogFactory
.
getLog
(
ConfigurablePropertiesLoader
.
class
);
this
.
log
=
deferredLogFactory
.
getLog
(
ConfigurablePropertiesLoader
.
class
);
}
}
/**
* Do not use asynchronous or thread pool to speed up configuration loading, as this may break the priority of configuration properties
*/
void
load
(
ConfigurableEnvironment
environment
,
SpringApplication
application
)
{
void
load
(
ConfigurableEnvironment
environment
,
SpringApplication
application
)
{
List
<
ConfigurableProperties
>
configurableProperties
=
loadFactories
(
ConfigurableProperties
.
class
,
getClass
().
getClassLoader
());
List
<
ConfigurableProperties
>
propertiesList
=
loadFactories
(
ConfigurableProperties
.
class
,
getClass
().
getClassLoader
());
if
(
CollectionUtils
.
isEmpty
(
configurableProperties
))
{
if
(
CollectionUtils
.
isEmpty
(
propertiesList
))
{
log
.
warn
(
"There is no configuration properties found"
);
log
.
warn
(
"There is no configuration properties found"
);
return
;
return
;
}
}
...
@@ -49,15 +52,15 @@ class ConfigurablePropertiesLoader {
...
@@ -49,15 +52,15 @@ class ConfigurablePropertiesLoader {
ApplicationEventMulticaster
eventMulticaster
=
createEventMulticaster
(
application
.
getListeners
());
ApplicationEventMulticaster
eventMulticaster
=
createEventMulticaster
(
application
.
getListeners
());
boolean
remoteFirst
=
ApolloProperties
.
get
(
environment
).
isRemoteFirst
();
boolean
remoteFirst
=
ApolloProperties
.
get
(
environment
).
isRemoteFirst
();
configurableProperties
.
parallelStream
().
forEach
(
properties
->
{
for
(
ConfigurableProperties
properties
:
propertiesList
)
{
OrderedMapPropertySource
propertySource
=
loadFromRemote
(
environment
,
remoteFirst
,
properties
.
getNamespace
());
OrderedMapPropertySource
propertySource
=
loadFromRemote
(
environment
,
remoteFirst
,
properties
.
getNamespace
());
if
(
propertySource
==
null
)
{
if
(
propertySource
==
null
)
{
return
;
continue
;
}
}
// multicast event
// multicast event
ConfigLoadedEvent
event
=
createEvent
(
environment
,
application
,
propertySource
,
properties
);
ConfigLoadedEvent
event
=
createEvent
(
environment
,
application
,
propertySource
,
properties
);
eventMulticaster
.
multicastEvent
(
event
,
ResolvableType
.
forClass
(
event
.
getClass
()));
eventMulticaster
.
multicastEvent
(
event
,
ResolvableType
.
forClass
(
event
.
getClass
()));
}
);
}
}
}
private
OrderedMapPropertySource
loadFromRemote
(
ConfigurableEnvironment
environment
,
boolean
remoteFirst
,
String
namespace
)
{
private
OrderedMapPropertySource
loadFromRemote
(
ConfigurableEnvironment
environment
,
boolean
remoteFirst
,
String
namespace
)
{
...
...
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