Search code examples
springspring-el

How do I reference a bean in spring-el named with a prefix?


As far as I know, I can inject sth by using spring-el like

<property name="someProperty" value="#{someBean.aMethod()}" />

But our code convention requires name bean with a prefix like

<bean id="{moduleName.ClassName}" />

This will cause spring-el resolve moduleName as a bean which does not exist.

Is there some way to escape the dot?


Solution

  • Try <property name="someProperty" value="#{@'moduleName.ClassName'.aMethod()}" /> .

    Hope this helps.