-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for Map injection #750
base: main
Are you sure you want to change the base?
Conversation
Can one of the admins verify this patch? |
@@ -121,6 +121,11 @@ public class InjectedConfigUsageSample { | |||
@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. |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
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.
@@ -121,6 +121,11 @@ public class InjectedConfigUsageSample { | |||
@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. | |||
@Inject | |||
@ConfigProperty(name = "myprj.some.reasons", defaultValue = "200=OK;201=Created") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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?
fix #562