Skip to content

Commit

Permalink
AddSpringProperty now add comments to application.properties files (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ammachado authored Dec 6, 2023
1 parent 4dccb9d commit 39fe593
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public boolean isAcceptable(SourceFile sourceFile, ExecutionContext ctx) {
if (t instanceof Yaml.Documents && sourcePathMatches(((SourceFile) t).getSourcePath(), ctx)) {
t = createMergeYamlVisitor().getVisitor().visit(t, ctx);
} else if (t instanceof Properties.File && sourcePathMatches(((SourceFile) t).getSourcePath(), ctx)) {
t = new AddProperty(property, value, null, null).getVisitor().visit(t, ctx);
t = new AddProperty(property, value, comment, null).getVisitor().visit(t, ctx);
}
return t;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ void addPropertyWithComment() {
""",
"""
server.port=8080
# This property was added
server.servlet.path=/tmp/my-server-path
"""
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void addLoggingPatternWhenUsingSleuth() {
"foo=bar",
"""
foo=bar
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
logging.pattern.level="%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"
""",
s -> s.path("src/main/resources/application.properties")
Expand Down

0 comments on commit 39fe593

Please sign in to comment.