You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to use immutable @ConfigurationProperties objects with @ConstructorBinding. Despite the opinion of many, I like my constructors to declare Optionals for optional arguments.
Currently I get a null value passed into my constructor if the property doesn't exist. It would be nice if an empty optional could be provided if the argument is of type optional and the value is null. Thoughts?
This probably doesn't help my case, but I should acknowledge I have the same problem with collection classes. It would be nice if empty versions of them were supplied instead of null also.
@youngm this is a duplicate of #18917. The collection case, in particular definitely is, Optional is just yet another case that we should consider when resolving this. I'll add a note to make sure we consider that as well.
I'm attempting to use immutable @ConfigurationProperties objects with @ConstructorBinding. Despite the opinion of many, I like my constructors to declare Optionals for optional arguments.
Currently I get a null value passed into my constructor if the property doesn't exist. It would be nice if an empty optional could be provided if the argument is of type optional and the value is null. Thoughts?
Juergen's suggestion spring-projects/spring-framework#18505 (comment) works great for mutable ConfigurationProperties classes but not immutable ones.
For further details, I'd like to have a class like so:
Instead my class looks like:
The text was updated successfully, but these errors were encountered: