Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
9281e2a4
Commit
9281e2a4
authored
Jun 25, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid creating JsonParser for VCAP_* parsing when running outside CF
Closes gh-13437
parent
8dbeb68a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
CloudFoundryVcapEnvironmentPostProcessor.java
.../boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java
+10
-8
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java
View file @
9281e2a4
...
...
@@ -101,8 +101,6 @@ public class CloudFoundryVcapEnvironmentPostProcessor
// Before ConfigFileApplicationListener so values there can use these ones
private
int
order
=
ConfigFileApplicationListener
.
DEFAULT_ORDER
-
1
;
private
final
JsonParser
parser
=
JsonParserFactory
.
getJsonParser
();
public
void
setOrder
(
int
order
)
{
this
.
order
=
order
;
}
...
...
@@ -117,9 +115,11 @@ public class CloudFoundryVcapEnvironmentPostProcessor
SpringApplication
application
)
{
if
(
CloudPlatform
.
CLOUD_FOUNDRY
.
isActive
(
environment
))
{
Properties
properties
=
new
Properties
();
addWithPrefix
(
properties
,
getPropertiesFromApplication
(
environment
),
JsonParser
jsonParser
=
JsonParserFactory
.
getJsonParser
();
addWithPrefix
(
properties
,
getPropertiesFromApplication
(
environment
,
jsonParser
),
"vcap.application."
);
addWithPrefix
(
properties
,
getPropertiesFromServices
(
environment
),
addWithPrefix
(
properties
,
getPropertiesFromServices
(
environment
,
jsonParser
),
"vcap.services."
);
MutablePropertySources
propertySources
=
environment
.
getPropertySources
();
if
(
propertySources
.
contains
(
...
...
@@ -142,11 +142,12 @@ public class CloudFoundryVcapEnvironmentPostProcessor
}
}
private
Properties
getPropertiesFromApplication
(
Environment
environment
)
{
private
Properties
getPropertiesFromApplication
(
Environment
environment
,
JsonParser
parser
)
{
Properties
properties
=
new
Properties
();
try
{
String
property
=
environment
.
getProperty
(
VCAP_APPLICATION
,
"{}"
);
Map
<
String
,
Object
>
map
=
this
.
parser
.
parseMap
(
property
);
Map
<
String
,
Object
>
map
=
parser
.
parseMap
(
property
);
extractPropertiesFromApplication
(
properties
,
map
);
}
catch
(
Exception
ex
)
{
...
...
@@ -155,11 +156,12 @@ public class CloudFoundryVcapEnvironmentPostProcessor
return
properties
;
}
private
Properties
getPropertiesFromServices
(
Environment
environment
)
{
private
Properties
getPropertiesFromServices
(
Environment
environment
,
JsonParser
parser
)
{
Properties
properties
=
new
Properties
();
try
{
String
property
=
environment
.
getProperty
(
VCAP_SERVICES
,
"{}"
);
Map
<
String
,
Object
>
map
=
this
.
parser
.
parseMap
(
property
);
Map
<
String
,
Object
>
map
=
parser
.
parseMap
(
property
);
extractPropertiesFromServices
(
properties
,
map
);
}
catch
(
Exception
ex
)
{
...
...
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