Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdi-dev] How to use ElAwareBeanManager to evaluate the EL result

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

Medium: https://medium.com/@hantsy

Back to the top