Automatic parsing of spring custom namespace beans?

I have a Spring custom namespace defined where a particular element generates two top level beans: one abstract one not (parent child relationship).  Intellij runs the custom namespace handler correctly when I tell it via the intention action.  However we use this element extensively and hiting Alt-Enter on every bean definition is prohibitive.  Is there a way to get Intellij 8.1.3 to automatically parse all custom bean definitions?  It seems like if the BeanDefinitionParser returns a single bean (e.g. derives from AbstractSimpleBeanDefinitionParser or AbstractSingleBeanDefinitionParser) Intellij asks if it should always assume beans of a particular class are generated.  However, with my tag, this isn't possible, since it looks a lot like the regular <bean> tag where a class name is specified.

Example:

<lm:base-bean id="myBean" >
    <property name="prop1" value="value1"
</lm:base-bean>

This generates two bean definitions as if I had written:

<bean id="baseMyBean" abstract="true" >
  <property name="prop1" value="value1"
</bean>
<bean id="myBean" parent="baseMyBean" />

Any ideas on how to get this parsed automatically with using the Alt-Enter intention action for every bean defined this way?

Thanks!
David

6 comments
Comment actions Permalink

A better approach would be to add spring tooling annotations to your XSD schema.

IDEA supports those (IIRC also the one that tells the resulting type of an element), and would not need to run the custom namespace handler at all.

0
Comment actions Permalink

Can you point me at some documentation about how this works?  I've had trouble finding anything that defines what the various xsd elements do
and why I'd use one versus another.

Thanks!
David

0
Comment actions Permalink

Also, from looking at the spring-tool.xsd, I'm not clear how I would specify that (a) multiple beans are defined and (b) that the 'class' attribute should be used to determine what type those beans are.

Thanks!
David

0
Comment actions Permalink

I think that the current tooling annotations don't cover such dynamic cases.

0
Comment actions Permalink

Currently there's no way to do it. Feel free to file a feature issue.
Would be great if you also have ideas on how to analyze such cases.

0
Comment actions Permalink

Did this ever get resolved?

It seems as though if IDEA is capable of introspecting a spring bean based on the class attribute, it should be capable of the same behavior on custom namespace beans which are simply dressed up spring beans, and which retain the class attribute.

0

Please sign in to leave a comment.