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

Replace Optional<List<T>> parameter to ObjectProvider<T> #5527

Closed
kth496 opened this issue Mar 25, 2024 · 3 comments · Fixed by #5573
Closed

Replace Optional<List<T>> parameter to ObjectProvider<T> #5527

kth496 opened this issue Mar 25, 2024 · 3 comments · Fixed by #5573
Labels
Milestone

Comments

@kth496
Copy link
Contributor

kth496 commented Mar 25, 2024

Motivation

Currently, some codebases continue to utilize the Optional<List> style. However, it is clearer to simply use an empty collection to signify that a parameter is absent. Since version 4.3, the Spring framework has offered the ObjectProvider, which is effective for managing the optionality of injection points. Conveniently, Armeria also leverages ObjectProvider.
(e.g. ArmeriaSpringActuatorAutoConfiguration.java)

Suggestion

Replace Optional<List<T>> parameter to ObjectProvider<T>

@jrhee17
Copy link
Contributor

jrhee17 commented Mar 26, 2024

Sure, sounds good 👍

@kratosmy
Copy link
Contributor

kratosmy commented Apr 1, 2024

Hi, @jrhee17 , could I take on this?

@jrhee17
Copy link
Contributor

jrhee17 commented Apr 1, 2024

Sure, go for it

jrhee17 pushed a commit that referenced this issue Apr 11, 2024
#5573)

Motivation:

Optional<T> is not as compatible as ObjectProvider<T>, which is included
in Spring Framework since Spring 4.3, so use ObjectProvider would
improve the programmatic resolution of Beans.

Modifications:

Two file are affected, AbstractArmeriaAutoConfiguration.java and
ArmeriaReactiveWebServerFactoryAutoConfiguration.java

Result:

Closes #5527 .
@jrhee17 jrhee17 added this to the 1.28.0 milestone Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment