Improve documentation for Cacheable#result (re: Optional wrapper) [SPR-14587] #19156
Comments
Stéphane Nicoll commented Karol Krawczyk it looks like you tried to implement a support for If you drop the |
Karol Krawczyk commented
|
Stéphane Nicoll commented Thanks for the fast reply.
I think I have to disagree. Considering that we now support optional, we make sure that If you had to truly do something on the result object,
Actually, you did (without noticing I suppose).. #18804 was implemented only as of 4.3.RC2 so you were previously storing the Having said that, we should be much more explicit with our meaning of |
Karol Krawczyk commented Ok, thank you for explanations! |
Stéphane Nicoll commented The documentation has been improved in 0d59a1. Thank you for the report! |
Karol Krawczyk opened SPR-14587 and commented
After migrating from spring-context 4.2.7 to spring-context 4.3.2 I noticed a change in a way you handle the caching of optionals.
If you look at the code below:
it throws:
EL1004E:(pos 1): Method call: Method isPresent() cannot be found on com.test.User type
It's because #result expression is now a concrete class and not Optional like before.
I am not sure if this is an intended behaviour or a bug. Though for me it is a bit misleading to be able to use Optionals for caching and at the same time to operate on unwrapped object for #result expression.
Affects: 4.3.2
1 votes, 2 watchers
The text was updated successfully, but these errors were encountered: