-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Properly take @Unremoveable into account for @ConfigMapping #29632
Conversation
Before this change, @Unremoveable was only being considered if there was an injection point
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 think this is not the right fix. We already check for the @Unremoveable
annotation and don't remove these beans:
quarkus/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
Lines 320 to 322 in 99e0134
if (configClass.getConfigClass().isAnnotationPresent(Unremovable.class)) { | |
bean.unremovable(); | |
} |
quarkus/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
Lines 425 to 430 in 99e0134
for (ConfigClassBuildItem configClass : configMappingTypes.values()) { | |
// We don't look in the beans here, because SR Config has an API that can retrieve the mapping without CDI | |
if (!arcConfig.shouldEnableBeanRemoval() || configClass.getConfigClass().isAnnotationPresent(Unremovable.class)) { | |
toRegister.add(new ConfigMappingBuildItem(configClass.getConfigClass(), configClass.getPrefix())); | |
} | |
} |
The issue is when the bean is marked unremovable with UnremovableBeanBuildItem
. Arc may not remove it, but we are not registering these with ConfigMappingBuildItem
, so they are missing in SmallRye Config and throw the NoSuchElementException
as detailed in #29583.
Okay, then I'll leave this one to you 😎 |
Sure :) |
Let's close this one then. |
Before this change, @Unremoveable was only being considered if there was an injection point