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
79cd01eb
Commit
79cd01eb
authored
Mar 03, 2016
by
Eric Bottard
Committed by
Stephane Nicoll
Mar 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix configuration property name when group is empty
See gh-5335
parent
49779057
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
4 deletions
+33
-4
RawConfigurationMetadata.java
.../boot/configurationmetadata/RawConfigurationMetadata.java
+3
-3
JsonReaderTests.java
...framework/boot/configurationmetadata/JsonReaderTests.java
+12
-1
configuration-metadata-emptygroup.json
...resources/metadata/configuration-metadata-emptygroup.json
+18
-0
No files found.
spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java
View file @
79cd01eb
...
...
@@ -77,10 +77,10 @@ class RawConfigurationMetadata {
}
ConfigurationMetadataSource
source
=
getSource
(
item
.
getSourceType
());
if
(
source
!=
null
)
{
String
groupId
=
source
.
getGroupId
()
;
String
dottedPrefix
=
source
.
getGroupId
()
+
"."
;
String
id
=
item
.
getId
();
if
(
id
.
startsWith
(
groupId
))
{
// match
String
name
=
id
.
substring
(
groupId
.
length
()
+
1
,
id
.
length
());
// "."
if
(
id
.
startsWith
(
dottedPrefix
))
{
String
name
=
id
.
substring
(
dottedPrefix
.
length
(),
id
.
length
());
item
.
setName
(
name
);
}
}
...
...
spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/JsonReaderTests.java
View file @
79cd01eb
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -52,6 +52,17 @@ public class JsonReaderTests extends AbstractConfigurationMetadataTests {
readFor
(
"invalid"
);
}
@Test
public
void
emptyGroupName
()
throws
IOException
{
RawConfigurationMetadata
rawMetadata
=
readFor
(
"emptygroup"
);
List
<
ConfigurationMetadataItem
>
items
=
rawMetadata
.
getItems
();
assertEquals
(
1
,
items
.
size
());
ConfigurationMetadataItem
item
=
items
.
get
(
0
);
assertProperty
(
item
,
"name"
,
"name"
,
String
.
class
,
null
);
}
@Test
public
void
simpleMetadata
()
throws
IOException
{
RawConfigurationMetadata
rawMetadata
=
readFor
(
"foo"
);
...
...
spring-boot-tools/spring-boot-configuration-metadata/src/test/resources/metadata/configuration-metadata-emptygroup.json
0 → 100644
View file @
79cd01eb
{
"groups"
:
[
{
"name"
:
""
,
"type"
:
"org.acme.Foo"
,
"sourceType"
:
"org.acme.config.FooApp"
,
"sourceMethod"
:
"foo()"
,
"description"
:
"This is Foo."
}
],
"properties"
:
[
{
"name"
:
"name"
,
"type"
:
"java.lang.String"
,
"sourceType"
:
"org.acme.Foo"
}
]
}
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