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
6710c057
Commit
6710c057
authored
Feb 10, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document `DeprecatedConfigurationProperty`
Closes gh-5118
parent
a1fefb15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
appendix-configuration-metadata.adoc
...cs/src/main/asciidoc/appendix-configuration-metadata.adoc
+34
-0
No files found.
spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc
View file @
6710c057
...
@@ -222,6 +222,40 @@ the `deprecation` element. This is still supported in a deprecated fashion and s
...
@@ -222,6 +222,40 @@ the `deprecation` element. This is still supported in a deprecated fashion and s
be used. If no reason and replacement are available, an empty `deprecation` object should be
be used. If no reason and replacement are available, an empty `deprecation` object should be
set.
set.
Deprecation can also be specified declaratively in code by adding the
`@DeprecatedConfigurationProperty` annotation to the getter exposing the deprecated
property. For instance, let's assume the `app.foo.target` property was confusing and
was renamed to `app.foo.name`
[source,java,indent=0]
----
@ConfigurationProperties("app.foo")
public class FooProperties {
private String name;
public String getName() { ... }
public void setName(String name) { ... }
@DeprecatedConfigurationProperty(replacement = "app.foo.name")
@Deprecated
public String getTarget() {
return getName();
}
@Deprecated
public void setTarget(String target) {
setName(target);
}
}
----
The code above makes sure that the deprecated property still works (delegating
to the `name` property behind the scenes). Once the `getTarget` and `setTarget`
methods can be removed from your public API, the automatic deprecation hint in the
meta-data will go away as well.
[[configuration-metadata-hints-attributes]]
[[configuration-metadata-hints-attributes]]
==== Hint Attributes
==== Hint Attributes
...
...
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