Skip to content

Commit

Permalink
Merge pull request #1560 from geoand/1315-docs
Browse files Browse the repository at this point in the history
Remove now unnecessary @Inject on @ConfigProperty
  • Loading branch information
starksm64 committed Mar 19, 2019
2 parents d5d4580 + 905dd5f commit 1c53f5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions docs/src/main/asciidoc/application-configuration-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,18 @@ Edit the `org.acme.config.GreetingResource`, and introduce the 3 following confi

[source,java]
----
@Inject
@ConfigProperty(name = "greeting.message")
private String message;
@Inject
@ConfigProperty(name = "greeting.suffix", defaultValue="!")
private String suffix;
@Inject
@ConfigProperty(name = "greeting.name")
private Optional<String> name;
----

NOTE: The `@Inject` annotation is not strictly necessary from members annotated with `@ConfigProperty`, a behavior which differs from https://microprofile.io/project/eclipse/microprofile-config[MicroProfile Config]

If you do not provide a value for the first property, it will have a `null` value.
The second property injects the given default value if the configuration file does not provide a value.
The third property is optional. The injected `Optional` is empty as the configuration file does not provide a value.
Expand Down Expand Up @@ -189,4 +188,4 @@ NOTE: Environment variables names are following the conversion rules of link:htt

There are converters that convert your property file content from `String` to typed Java types. See the list link:https://github.com/eclipse/microprofile-config/blob/master/spec/src/main/asciidoc/converters.asciidoc[in the specification].

// TODO: make Ken review this section and discuss SmallRye expansion.
// TODO: make Ken review this section and discuss SmallRye expansion.
1 change: 0 additions & 1 deletion docs/src/main/asciidoc/health-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ import javax.inject.Inject;
@ApplicationScoped
public class DatabaseConnectionHealthCheck implements HealthCheck {
@Inject
@ConfigProperty(name = "database.up", defaultValue = "false")
private boolean databaseUp;
Expand Down

0 comments on commit 1c53f5b

Please sign in to comment.