Closed gwenneg closed 3 days ago
This looks like really useful content!
(I haven't done a proper review because it's something I'm never entirely sure how to do, so I can't provide the right level of technical comments ... but I'm happy this has been written. :) )
@radcortez would you have the time to have a quick look at this blog post?
@radcortez would you have the time to have a quick look at this blog post?
I'll have a look.
Most of the blog is about using @ConfigProperty
. I think we shouldn't promote @ConfigProperty
as the primary way to inject/retrieve configuration. @ConfigProperty
has many limitations, and users should use @ConfigMapping
instead.
Thanks everyone for reviewing my PR!
@radcortez Could you please share more details about why @ConfigMapping
is a better choice than @ConfigProperty
?
The purpose of this post is only to talk about ways to override the config values and not how to better inject the configuration. These two topics look a bit orthogonal to me, even though I understand your point. Would it be enough if I added a NOTE
at the beginning promoting @ConfigMapping
as a better way than @ConfigProperty
to inject the config?
Shouldn't the Quarkus guides about config be updated to better promote @ConfigMapping
?
I only updated the post date in the commit I just pushed.
I think one thing this discussion about mapping and property shows is how potentially valuable the kind of content @gwenneg has created will be; we have a bit of an information gap, which means it's maybe easier than it should be for even skilled users to end up using sub-optimal patterns.
I may be missing something about @ConfigMapping
but I'm not convinced (yet) @ConfigProperty
is always a sub-optimal choice.
In the cloud apps I'm responsible for, we:
@ConfigProperty
makes all that stuff reasonably easy. I'm not sure how @ConfigMapping
would make any of that easier/better.
@radcortez Could you please share more details about why
@ConfigMapping
is a better choice than@ConfigProperty
?
Sure:
@ConfigMapping
does not require CDI, and a mapping object can be retrieved programmatically in any context@ConfigProperty
only supports common types and limited combinations. For instance Map<K, Element>
is not supported.The purpose of this post is only to talk about ways to override the config values and not how to better inject the configuration. These two topics look a bit orthogonal to me, even though I understand your point. Would it be enough if I added a
NOTE
at the beginning promoting@ConfigMapping
as a better way than@ConfigProperty
to inject the config?
I understand, and please don't take me wrong. I think it is a great article. @ConfigProperty
comes from the MP Config specification, which stopped all the work in favor of Jakarta Config. I feel that we shouldn't be endorsing an API where the current status is unknown at best.
@ConfigProperty
makes all that stuff reasonably easy. I'm not sure how@ConfigMapping
would make any of that easier/better.
That is great :) I had no intention to start a debate on how things should be done. If users are happy, I'm also happy :)
Thanks for the details @radcortez, that is very interesting. I no longer doubt that @ConfigMapping
is better than @ConfigProperty
. I'm glad we had that discussion 😄
Is jakarta.config.ConfigMapping
supported by Quarkus already?
FYI I'm updating the blog post and repo. I'll submit a better version (more @ConfigMapping
-oriented) of the post tomorrow.
Is
jakarta.config.ConfigMapping
supported by Quarkus already?
We don't have a Jakarta Config release yet. There is a lot of work. Maybe by the end of the year. A few things that we learned about configuration are going into Jakarta Config and @ConfigMapping
from SmallRye Config is an example.
BTW, if you end up trying @ConfigMapping
more, feel free to reach out and let me know if you find any gaps. I'm happy to help :)
@radcortez I just pushed a big post update which gives more visibility to config mappings. @ConfigProperty
is still here but always comes second. Please let me know if that looks better.
@radcortez I just pushed a big post update which gives more visibility to config mappings.
@ConfigProperty
is still here but always comes second. Please let me know if that looks better.
Thank you for the change. Really appreciate it.
@radcortez I pushed another change related to profile aware files. Could you please confirm that what I wrote is correct? I'm not 100% sure about the details related to src/main/resources
vs src/test/resources
in native mode. I tested everything in this repo and then transformed the result of my tests into the addition to the blog post.
@radcortez I pushed another change related to profile aware files. Could you please confirm that what I wrote is correct? I'm not 100% sure about the details related to
src/main/resources
vssrc/test/resources
in native mode. I tested everything in this repo and then transformed the result of my tests into the addition to the blog post.
Yes, the native image build only considers main
sources. You don't want your test sources to be included in the image that goes to prod :)
@gsmet Do you want to take another look before this is merged? A lot of things changed in the post since your first review.
Thanks everyone for the reviews and @radcortez in particular for helping me make that post better!
🙈 The PR is closed and the preview is expired.