-
Notifications
You must be signed in to change notification settings - Fork 115
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
Improve ConfigProperty lookup #682
Comments
This can be achieved by adding |
The initial API was using I can't find any reason for why it was changed. Do you remember? |
@radcortez thanks for digging further! Originally I proposed to have the With both Basically, the attribute |
I'd like to make sure I understand this absolutely clearly. You are proposing that:
Does that correctly represent what you are proposing? This will almost certainly be immensely confusing to end users and consequently I object to it. Perhaps a replacement annotation is called for instead (perhaps without default-value semantics as well, given how haphazardly #446 (and #531 and #532 and #533) was addressed, and how thorny default values are in general, and how difficult they are, therefore, to encode in the primary qualifier annotation, as many issues have borne out)? Simpler, clearer replacement possibilities might include:
|
@ljnelson I really don't understand what you are objecting about. This issue neither fix or make the existing behaviours you listed above any worse though as I am not touching any |
I believe that using See #671 for one issue about |
In SR Config we added additional annotations (they work only for the mapping classes), but maybe they can serve as an inspirations: |
@Emily-Jiang I know this came from a discussion we had, but one downside of this is to make this work we would have to mark both value and name as optional. That would means someone could use the annotation with no attributes which would be wrong. However I have confirmed if there is an attribute of |
Is this 'simplification' worth the possible confusion about the meaning of all attributes? |
I think that a better solution would be to introduce a new annotation and deprecate the old one. This way there is no need to handle multiple optional annotation attributes - each annotation has a mandatory attribute. I also think that default value should not be part of the annotation - we could do similar what JAX-RS is doing:
|
I don't see much value to introduce a brandnew annotation in order to achieve a fairly minimal improvement. This leads end users further learning new things. I would rather stay with |
I agree with @tomas-langer and @rdebusscher. Having 2 attributes meaning the same thing is confusing and it's not a simplification. I am voting for deprecation of |
I can understand the perspective that says having name and value meaning the same thing would be confusing and would be more confusing than having people write name. However I think deprecating If I saw |
I share the concern of logical combination. If a Java property is annotated with Example:
|
For |
After this discussion, I think we have two viable options to improve the current |
Option 1 : add
|
Option 2: update the default value
|
@Emily-Jiang, I am sorry to say that, but the options you provided are both wrong. In the first option Option 1: Introduce
Option 2: Introduce 2 additional annotations
|
@m0mus not really. The
This should work, but I don't think it should be promoted as specifying
|
I was talking about your sample code. On the first like of your code So, this code (your option one)
must be replaced with this one:
The annotation name in option 2 is not agreed. I actually said that in my previous comment. We may come up with a different name. Important is the concept of 2 annotations. |
@Emily-Jiang - in both options you propose, you use:
This is very confusing, as you use This is confusing and neither of the options is good |
ah. Sorry for the confusion. It was a typo. I meant |
@Emily-Jiang, I understand that you are prefer the first option, but I don't see that the consensus is reached. There are other opinions. I would appreciate if you fix your voting options and users actually vote. Please reopen this issue. |
@m0mus this issue is about improving |
As mentoned earlier, repopen this issue for further conversation to see whether we can reach any consensus. |
Description
As a:
...I need to be able to:
use
@Inject @ConfigProperty("property.name")
instead of having to put a name attribute there@Inject @ConfigProperty(name="property.name")
...which enables me to:
simply my lookup.
The text was updated successfully, but these errors were encountered: