-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
SpEL T()
operator not able to locate user types with default StandardTypeLocator
configuration
#26253
Comments
got the same bug. my Cacheable: @Cacheable(value = "myValue", key = "#myKey", cacheManager = "myManager",
unless = "#result.erreur != null && #result.erreur.myEnumValue == T(com.xxx.MyEnum).YYY") work fine calling it without async..... but if done with CompletableFuture.supplyAsync(() -> my function()) Error :
stupid workarround: @Cacheable(value = "infoTelephones", key = "#numeroTelephone", cacheManager = "infoTelephonesCacheManager",
unless = "#result.notCacheable") and move the test in the method added on the object... |
It turned out it was an issue with StandardTypeLocator used by Thymeleaf Context: dunno why, but sometimes it gets created with System classloader, so it can't resolve our app types. Context ctx = new Context(locale);
StandardEvaluationContext delegate = new StandardEvaluationContext();
StandardTypeLocator tl = new StandardTypeLocator(MyClass.class.getClassLoader());
delegate.setTypeLocator(tl);
EvaluationContext evaluationContext = new ThymeleafEvaluationContextWrapper(delegate);
ctx.setVariable(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME,
evaluationContext); |
Hey @jjpianta, have we got any updates regarding this? Can this be solved without some dirty work around? |
Hi @vvvinamer.
No, here we have no update, we're still going with the *dirty fix*.
Cheers
J.J.
…On Mon, 16 May 2022 at 20:54, vvvinamer ***@***.***> wrote:
Hey @jjpianta <https://github.com/jjpianta>, have we got any updates
regarding this? Can this be solved without some dirty work around?
—
Reply to this email directly, view it on GitHub
<#26253 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVFRMXUWW4GYN5XVHYEMXLVKKKWVANCNFSM4UUY53YQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I still run into this as of 2023 with java 18 + spring boot 2.7.7 (spring framework 5.3.24) |
SpelEvaluationException
with T()
operator - EL1005E: Type cannot be found
SpelEvaluationException
with T()
operator - EL1005E: Type cannot be foundT()
operator not able to locate user types with default StandardTypeLocator
configuration
I don't necessarily consider that a "dirty fix" but rather a robust solution. The SpEL expression parser needs to be able to reliably locate user types, and providing a suitable |
This issue has been repurposed to improve the documentation regarding proper configuration of the See 10de295 for details. |
Hi,
we are experiencing such a strange behavior using
SPEL T()
operator to get references to custom enums or types in our thymeleaf templates: everything goes straight till we get random failures in resolving our custom types."random" means that same expression sometimes get parsed properly and sometimes don't.
It looks like failures occur only in asynch context (
StreamingResponseBody
's callbacks and@Asynch
annotated methods)Same issue submitted to the Thymeleaf team
see full stack trace
The text was updated successfully, but these errors were encountered: