Skip to content
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

4.x: List injection should not fail on empty list #7082

Closed
tomas-langer opened this issue Jun 23, 2023 · 2 comments
Closed

4.x: List injection should not fail on empty list #7082

tomas-langer opened this issue Jun 23, 2023 · 2 comments
Assignees
Labels
4.x Version 4.x declarative Helidon Declarative task To do
Milestone

Comments

@tomas-langer
Copy link
Member

tomas-langer commented Jun 23, 2023

Currently when we inject a List<ServiceProvider<SomeType>>, if there is no provider of SomeType available, we get an exception.
The workaround is to manually use PicoServices.realizedServices() to lookup all with expected set to false

The default behavior I think should be to use empty list if none is found, as this is going to be used for looking up extensions by users (Http services, config sources etc.) that may not be present.

This should be fixed in:
ConfigProducer (if already merged)
LoomServer - now fails if no service discovered

@tomas-langer tomas-langer added 4.x Version 4.x declarative Helidon Declarative labels Jun 23, 2023
@tomas-langer tomas-langer added the task To do label Jun 23, 2023
@m0mus m0mus added this to the 4.0.0-M2 milestone Jun 26, 2023
@trentjeff trentjeff self-assigned this Jul 6, 2023
@trentjeff
Copy link
Member

trentjeff commented Jul 6, 2023

I'm debating whether to just fix this to "allow empty lists always", or proactively adding @InjectOptions to the API with an attribute boolean atLeastOne - thoughts on which direction to take - simple or advanced??

@tomas-langer
Copy link
Member Author

Please go with the "simple" approach of allowing injection of empty lists.

trentjeff added a commit to trentjeff/helidon that referenced this issue Jul 7, 2023
trentjeff added a commit that referenced this issue Jul 10, 2023
@m0mus m0mus added this to Backlog Aug 12, 2024
@m0mus m0mus moved this to Closed in Backlog Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x declarative Helidon Declarative task To do
Projects
Archived in project
Development

No branches or pull requests

3 participants