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
6828a15d
Commit
6828a15d
authored
Nov 07, 2019
by
Hans Schulz
Committed by
Madhura Bhave
Feb 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle JSON keys containing a dot from CF environment as a single path segment
See gh-18915
parent
b0aba9ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
CloudFoundryVcapEnvironmentPostProcessor.java
.../boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java
+3
-0
CloudFoundryVcapEnvironmentPostProcessorTests.java
...oundry/CloudFoundryVcapEnvironmentPostProcessorTests.java
+10
-0
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java
View file @
6828a15d
...
...
@@ -230,6 +230,9 @@ public class CloudFoundryVcapEnvironmentPostProcessor
if
(
key
.
startsWith
(
"["
))
{
return
path
+
key
;
}
if
(
key
.
contains
(
"."
))
{
return
path
+
"["
+
key
+
"]"
;
}
return
path
+
"."
+
key
;
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/cloud/cloudfoundry/CloudFoundryVcapEnvironmentPostProcessorTests.java
View file @
6828a15d
...
...
@@ -117,6 +117,16 @@ public class CloudFoundryVcapEnvironmentPostProcessorTests {
assertThat
(
getProperty
(
"vcap.services.mysql.credentials.port"
)).
isEqualTo
(
"3306"
);
}
@Test
void
testServicePropertiesContainingKeysWithDot
()
{
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
this
.
context
,
"VCAP_SERVICES={\"user-provided\":[{\"name\":\"test\",\"label\":\"test-label\","
+
"\"credentials\":{\"key.with.dots\":\"some-value\"}}]}"
);
this
.
initializer
.
postProcessEnvironment
(
this
.
context
.
getEnvironment
(),
null
);
assertThat
(
getProperty
(
"vcap.services.test.name"
)).
isEqualTo
(
"test"
);
assertThat
(
getProperty
(
"vcap.services.test.credentials[key.with.dots]"
)).
isEqualTo
(
"some-value"
);
}
private
String
getProperty
(
String
key
)
{
return
this
.
context
.
getEnvironment
().
getProperty
(
key
);
}
...
...
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