Hi,
I check the new ELAwareBeanManager, the new method getELResovler() can not evaluate the _expression_ directly.
there's nothing new about getELResolver() . That method has existed on
BeanManager since CDI 1.0 I think — the only thing we did was we pushed it (and one other method) down to a subinterface which exists in another module (JAR), so that the main
cdi-api module doesn't have to have a dependency on EL. AFAICT, the methods on
ELAwareBeanManager are not supposed to be used by end users, they only exist for integrators to be able to integrate CDI with EL.
LT
From: cdi-dev <cdi-dev-bounces@xxxxxxxxxxx> on behalf of hantsy bai via cdi-dev <cdi-dev@xxxxxxxxxxx>
Sent: Saturday, July 12, 2025 18:23
To: cdi-dev@xxxxxxxxxxx <cdi-dev@xxxxxxxxxxx>
Cc: hantsy bai <hantsy@xxxxxxxxx>
Subject: [EXTERNAL] [cdi-dev] How to use ElAwareBeanManager to evaluate the EL result
This Message Is From an External Sender
This message came from outside your organization.
Hi
I check the new ELAwareBeanManager, the new method getELResovler() can not evaluate the _expression_ directly.
I have tried to use invoke to call a method of a bean like this.
ELManager elManager = new ELManager(); var resolvedResult = beanManager.getELResolver().invoke(elManager.getELContext(), elGreeter, "hello", new Class[]{String.class}, new String[]{"ELAwareBeanManager"});
Here, elGreeter is an injected bean; it has a method called `hello` that accepts a String as a parameter and returns a String.
This resolvedResult is null. Not the expected string: Hello,
ELAwareBeanManager
1. Is there a simple way to evaluate an _expression_ on the CDI side?
2. I found all global instances in EL that can be application-scoped beans not exposed, eg, ElContext, ElManager, and ExpressionFactory, etc.
---
Regards,
Hantsy Bai
Self-employed consultant, fullstack developer, agile coach, freelancer/remote worker
GitHub:
https://github.com/hantsy
Twitter:
https://twitter.com/@hantsy
|