Simon,

You can create and register your own PropertyEditors to get around this. PropertyEditors convert the string representation to an object for injection.

See http://static.springframework.org/spring/docs/2.5.x/reference/validation.html#beans-beans-conversion-customeditor-registration


Valdis


Simon Olofsson wrote:
Hi,

I've been working with Restlet for some time now, and it's a great
framework.

But I've got one problem with the Spring Extension in 1.1 M1. I want to
use SpringHost and attach some Restlets to it. SpringHost has the method
setRoutes(Map<String,Object> routes). But when I configure this in my
beans.xml:
  <bean id="myID" class="org.restlet.ext.spring.SpringHost">
    <property name="resourceDomain" value="^myVHost.*" />
    <property name="routes">
      <map>
        <entry key="/">
          <bean class="MyRestlet" />
        </entry>
      </map>
    </property>
  </bean>
I get the following error:
[...]java.lang.IllegalArgumentException: Cannot convert value of type
[java.util.LinkedHashMap] to required type [org.restlet.util.RouteList]
for property 'routes'[...]
It seems that Spring tries to call the method setRoutes(RouteList
routes) from the Router class.

When I create my own class MySpringHost (extends VirtualHost) and name
the method setAttachments(Map<String, Object> routes) and then use:
  <bean id="myID" class="MySpringHost">
    <property name="resourceDomain" value="^myVHost.*" />
    <property name="attachments">
      <map>
        <entry key="/">
          <bean class="MyRestlet" />
        </entry>
      </map>
    </property>
  </bean>
everything works fine.

Is there any workaround or configuration option, other than creating my
own SpringHost and renaming the method?

Thanks,
Simon

Reply via email to