Resolve Spring context in EL Expression in XML

Hello there

I've got a xml file with an el expression in the content of a xml tag.

<sometag>${bean.value}</sometag>

I used the feature language injection to mark this content as a el expression, thus IDEA know this and handle this expression right. But it's not using the configured spring configuration to resolve the el expression. IDEA does this for JSF pages, so is it somehow possible to configure this also for xml files?

Thanks
Stefan

11 comments
Comment actions Permalink

Hi Stefan,

Typically the Spring EL placeholders are using #{...} syntax.
(The regular property-placeholder support uses ${...} by default)
Are you sure that you're using the correct syntax?

-tt

0
Comment actions Permalink

Hi Taras

Thanks for your answer. Sorry, I use the notation you mentioned "#{}". Apparantly I was in kind of clouded yesterday :), I don't no why. I always use the hash syntax...

So my problem in detail: I've got a spring configuration file where I defined

<bean id="adHocService" />


And I've got an xml file with

<sequenceFlow id="sequenceFlow2" name="no" sourceRef="adHocTasksExistingDiverging" targetRef="endEvent1">
     <conditionExpression id="sid-ccf227a3-c545-4b5d-89a7-7eb309a351e6" xsi:type="tFormalExpression">#{adHocService.adHocTaskCount == 0}</conditionExpression>
</sequenceFlow>


And IDEA is not able to resolve the variable adHocService.

Any ideas?

Cheers
Stefan

0
Comment actions Permalink

Hi Stefan,

Is the "sequenceFlow" element part of a custom spring namespace? If so which one? (is it one from a public project?)

Cheers,
-tt

0
Comment actions Permalink

Hi Taras

SequenceFlow is part of BPMN 2.0 (http://www.omg.org/spec/BPMN/20100501/BPMN20.xsd).

Greetings
Stefan

0
Comment actions Permalink

Hi Stefan,

Perhaps I'm not fully understanding: if it's just an XML file, who/what is processing the embedded EL expressions?

Cheers,
-tt

0
Comment actions Permalink

As i understand, it's a custom spring bean. Probably you have to parse definition for that bean to get working el expressions. (if idea supports them at all)

regards, Alex

0
Comment actions Permalink

Hi Taras

I used the feature language injection to mark the certain string to be managed as an el expression. IDEA parses it and report errors and so on. Now IDEA knows that it is an el expression. It would be easy to resolve this el expression since IDEA knows my bean definitions.

My question is

  1. Is IDEA able to do this resolving out of xml files? (as it does within jsf files)
  2. If it is able to do so, what do I have to do to get it run



Sorry for this confusion, I probably asked my question wrong at beginning :)

Cheers Stefan

0
Comment actions Permalink

Hi Alex

Yes, it's a custom spring bean.

Regards
Stefan

0
Comment actions Permalink

Hi Stefan,

As far as I know, the EL language injection is not magically connected to any Spring beans model.

-tt

0
Comment actions Permalink

Thanks Taras, that helps. In this case I think I'll create an JIRA issue for an improvement :)

Cheers
Stefan

0
Comment actions Permalink

Note that, at the moment, IDEA does not support many Spring-EL constructs.
Actually, "regular/JSP EL" is injected into #{...} regions in spring xml.

You might want to add your vote to the ticket asking for full SpEL support:
http://youtrack.jetbrains.net/issue/IDEA-64627

-tt

0

Please sign in to leave a comment.