Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdi-dev] How to use ElAwareBeanManager to evaluate the EL result
  • From: Ladislav Thon <lthon@xxxxxxx>
  • Date: Mon, 14 Jul 2025 07:25:19 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ibm.com; dmarc=pass action=none header.from=ibm.com; dkim=pass header.d=ibm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g/SuAGxw14U65WTtTtVbt9xHtWXzANzqM692Jwpilx0=; b=DEFmkSBT+EnRKb1L+C35dOTxulYxfRU6jwF7wncPsBd7aFjMKsoowFHV+Forv4xrqPioinUeIn0Ch+ydiPeGvk4xANA3hxeHNyaANqYjCx1wk57Aqg1nObmAd9k9SogbKdDsjklOJTzeGqv8A/W5Vx5oDHPC4Nj29S30XCcvtVoWm+1rdoyGttbaxPoSGfQBKZumkrTlYDiV4+hfYHbbF9FKXQn0AillRI9VOZdGuPN1MtRsXpYnAJaTtiYMlP51dGI5fSopl7ucwFxn683Up4yKmpNQOBaaEC532qNqN16LnRepicnGWWltyTDRyJjZhKR/XTkOTrW2gKRZMZPNeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PU7Dv6Cw+CwMP4c6AYLZwwqv3W+sDIreECfXY2wPysu5WDi7HtQ3iPnIW09ErbA42HEE+39NTiayoFMbS2q0Pd6lngXOTq/iBGLGyAdLTP+0uFy/bwqIr2c8EQW9kuRm7iy/Pq9qgENFXkBg8xBdERGETeO0J5+5I7PTvjcXIr+ipPb3l887+0Lk7VaL5Aw1KL/lTtOrkUSWv6qqNuLSaAcsUc8ApFSiFiRIzsPaFXy6Z6/Rpr/WQCQTZV54HOFHgJEDpQGW2LLZnytWPFtwyN6FJSIhPu+Z4xvgsr3tzafv92FJuHspoINFxwYNZp/jOgmCP7+842cTdfdI9Hy+GQ==
  • Delivered-to: cdi-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/cdi-dev/>
  • List-help: <mailto:cdi-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/cdi-dev>, <mailto:cdi-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/cdi-dev>, <mailto:cdi-dev-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHb80lRhOm7Ex7Mp0Wyws6X3JWUkLQxOVtH
  • Thread-topic: [EXTERNAL] [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. 

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


Back to the top