开发者

Eclipse Spring Builder set properties with Groovy beans

I typically use groovy to construct simple bean but the Spring IDE plugin to eclipse fails to build when I try to set a property that is generated by groovy without an explicit setter. For example,

class MyGrooyClass {
    def propertyA
}

and in the s开发者_运维百科pring configuration file I have something that looks like:

<bean id="MyGroovyClassBean" class="MyGroovyClass">
  <property name="propertyA" value="someValue"/>
</bean>

The spring builder says there is no such property but it is in the bytecode since it is automatically generated by groovy. If I don't validate that bean, everything works, so spring can resolve the property, but it seems to be an issue with the plugin. Is there a way to work around this or to disable validating a particular bean?

EDIT: I can construct the bean using the groovy specific syntax

<lang:groovy id="..." script-source="...">
  <lang:property name="propertyA" value="someValue"/>
</lang>

but it seems odd that I should need to do this just for the plugin.

Thanks, Jeff


It definitely looks like a bug in the Spring IDE plugin. I've also had issues where the content assist does not show auto-complete for properties of a Groovy bean.

I see the same issue in the project I am working on. Consequently I do not use the Spring Validator.


As confirmed by Chris Dail, this is a bug in the Spring IDE plugin. I posted it in the Spring forums http://forum.springsource.org/showthread.php?p=271607&posted=1#post271607 and it has been fixed in the nightly build.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜