2

In Spring I can create a bean from an inner class thus:

<bean id="exampleInnerBean" class="my.package.Class$InnerClass" />

But in Blueprint this doesn't work, I get a SAXParseException:

cvc-datatype-valid.1.2.1: 'my.package.Class$InnerClass' is not a valid value for 'NCName'.

Any ideas what I'm doing wrong / what syntax I should be using / if this is even possible?

If it helps / matters, I'm installing a bundle containing the above bean into JBoss Fuse 6.0.0.

Many thanks

4

1 回答 1

1

我能够使用与 Java 相同的语法:

<bean id="exampleInnerBean" class="my.package.Clazz.InnerClass" />

我面临的唯一问题是因为我正在使用Maven Bundle 插件......插件假定它my.package.Clazz是一个包,因此将它添加到我的包的导入包列表中。只需将以下内容添加到<configuration><instructions>POM 中的插件标记即可解决此问题:

 <Import-Package>!my.package.Clazz,*</Import-Package>

这会阻止插件将 my.package.Clazz 添加到我的包的导入包列表中,并且一切正常。

于 2013-09-22T10:30:37.793 回答