Skip to content

Conversation

@rmanibus
Copy link

fix #562

@eclipse-microprofile-bot
Copy link
Contributor

Can one of the admins verify this patch?

@ConfigProperty(name="myprj.some.supplier.timeout", defaultValue="100")
private java.util.function.Supplier<Long> timeout;
//Injects a Map to resolve multiple configuration parameters under the same configuration key.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the Map injection, what types for Key, Value do you propose to support? We need to clarify that.

//Injects a Map to resolve multiple configuration parameters under the same configuration key.
@Inject
@ConfigProperty(name = "myprj.some.reasons", defaultValue = "200=OK;201=Created")
private java.util.Map<Integer, String> reasons;
Copy link

@otaviojava otaviojava Sep 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private java.util.Map<Integer, String> reasons;
private java.util.Map<String, String> reasons;

Once we're talking about configuration, I believe the key must be a String

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree to narrow down to Map<String, String>. Otherwise, it will be overwhelming with the tests and it might have more issues to deal with regarding conversion errors.

//Injects a Map to resolve multiple configuration parameters under the same configuration key.
@Inject
@ConfigProperty(name = "myprj.some.reasons", defaultValue = "200=OK;201=Created")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specification must define how the map properties are parsed (both on a source and in the defaults).

public class MapConverterBean {

@Inject
@ConfigProperty(name = "tck.config.test.javaconfig.converter.map.string.string")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we call the programmatic API? What happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to fetch multiple config parameters as a Map

5 participants