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
6602fa3c
Commit
6602fa3c
authored
Jul 13, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean line breaks in configuration metadata descriptions.
Closes gh-13601
parent
c23c18dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
0 deletions
+72
-0
TypeUtils.java
...pringframework/boot/configurationprocessor/TypeUtils.java
+1
-0
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+15
-0
DescriptionProperties.java
...oot/configurationsample/simple/DescriptionProperties.java
+56
-0
No files found.
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java
View file @
6602fa3c
...
...
@@ -142,6 +142,7 @@ class TypeUtils {
String
javadoc
=
(
element
!=
null
?
this
.
env
.
getElementUtils
().
getDocComment
(
element
)
:
null
);
if
(
javadoc
!=
null
)
{
javadoc
=
javadoc
.
replaceAll
(
"\\n"
,
""
);
javadoc
=
javadoc
.
trim
();
}
return
(
""
.
equals
(
javadoc
)
?
null
:
javadoc
);
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
6602fa3c
...
...
@@ -55,6 +55,7 @@ import org.springframework.boot.configurationsample.method.MethodAndClassConfig;
import
org.springframework.boot.configurationsample.method.SimpleMethodConfig
;
import
org.springframework.boot.configurationsample.simple.ClassWithNestedProperties
;
import
org.springframework.boot.configurationsample.simple.DeprecatedSingleProperty
;
import
org.springframework.boot.configurationsample.simple.DescriptionProperties
;
import
org.springframework.boot.configurationsample.simple.HierarchicalProperties
;
import
org.springframework.boot.configurationsample.simple.NotAnnotated
;
import
org.springframework.boot.configurationsample.simple.SimpleArrayProperties
;
...
...
@@ -192,6 +193,20 @@ public class ConfigurationMetadataAnnotationProcessorTests {
.
fromSource
(
HierarchicalProperties
.
class
));
}
@Test
public
void
descriptionProperties
()
{
ConfigurationMetadata
metadata
=
compile
(
DescriptionProperties
.
class
);
assertThat
(
metadata
).
has
(
Metadata
.
withGroup
(
"description"
)
.
fromSource
(
DescriptionProperties
.
class
));
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"description.simple"
,
String
.
class
)
.
fromSource
(
DescriptionProperties
.
class
)
.
withDescription
(
"A simple description."
));
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"description.multi-line"
,
String
.
class
)
.
fromSource
(
DescriptionProperties
.
class
).
withDescription
(
"This is a lengthy description that spans across multiple lines to showcase that the carriage return is cleaned automatically."
));
}
@Test
@SuppressWarnings
(
"deprecation"
)
public
void
deprecatedProperties
()
throws
Exception
{
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/DescriptionProperties.java
0 → 100644
View file @
6602fa3c
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
configurationsample
.
simple
;
import
org.springframework.boot.configurationsample.ConfigurationProperties
;
/**
* Configuration properties with various description styles.
*
* @author Stephane Nicoll
*/
@ConfigurationProperties
(
"description"
)
public
class
DescriptionProperties
{
/**
* A simple description.
*/
private
String
simple
;
/**
* This is a lengthy description that spans across multiple lines to showcase that the
* carriage return is cleaned automatically.
*/
private
String
multiLine
;
public
String
getSimple
()
{
return
this
.
simple
;
}
public
void
setSimple
(
String
simple
)
{
this
.
simple
=
simple
;
}
public
String
getMultiLine
()
{
return
this
.
multiLine
;
}
public
void
setMultiLine
(
String
multiLine
)
{
this
.
multiLine
=
multiLine
;
}
}
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