Search code examples
springrestletspring-bean

Spring code replacement for lookup-method


I'm using Restlet Framework with Spring and I'm currently configuring it in xml. In restlet Router you have a map of resources in the form of [[path, resource], ...] To create a resource I'm currently using lookup-method like this:

<bean id="router" class="org.restlet.ext.spring.SpringRouter">
    <property name="attachments">
        <map>
            <entry key="/login">
                <bean class="org.restlet.ext.spring.SpringFinder">
                    <lookup-method name="create"
                                   bean="loginResource" />
                </bean>
            </entry>
        </map>
    </property>
</bean>

loginResource is specified as a @Component. Now here is a tricky part. When I'll add more resources the configuration will get messy and I don't want it. I prefer annotation config, but to do it I need a replacement for lookup-method.

I want to create SpringFinder class at runtime as if it were created in the configuration way above.

It there any way to do it?


Solution

  • Unfortunately, this feature is still not implemented. You can address to ticket in Spring JIRA https://jira.spring.io/browse/SPR-5192