Skip to content

Commit

Permalink
Fix Map documentation (#928)
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez authored Apr 26, 2023
1 parent 0c6e262 commit ecfdb75
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions documentation/src/main/docs/config/map-support.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Map Support

SmallRye Config allows injecting multiple configuration parameters as a `Map`. The configuration value syntax is
represented by `<key1>=<value1>;<key2>=<value2>` Consider:
represented by `property.name.map-key=value` Consider:

```properties
server.reasons=200=OK;201=Created
server.reasons.200=OK
server.reasons.201=Created
```

The previous configuration could be injected directly in a CDI Bean:
Expand All @@ -15,7 +16,7 @@ With `@ConfigProperty`
@ApplicationScoped
public class ConfigBean {
@Inject
@ConfigProperty(name = "server.reasons", defaultValue = "200=OK;201=Created")
@ConfigProperty(name = "server.reasons")
Map<Integer, String> reasons;
}
```
Expand All @@ -29,6 +30,8 @@ public class Config {
}
```

The `Map` will contains the keys `200` and `201`, which map to the values `OK` and `Created`.

!!!note

Only the direct sub properties will be converted into a `Map` and
Expand Down

0 comments on commit ecfdb75

Please sign in to comment.