Hi Grzegorz, hi Reinhard,
thanks for your replies!
Reinhard Pötz schrieb:
Grzegorz Kossakowski wrote:
Andreas Hartmann pisze:
[…]
Andreas, have a look at "bean-maps" which are provided by the Spring
Configurator. You could have your validators implement a particular
interface and then you can collect them by using a bean-map. The you can
implement a validator servlet-service that uses this bean-map and does
the validation. Of course the last step is only necessary if you need to
get access to the validator services by using the servlet protocol.
I found the documentation on bean maps and Grzegorz' blog entry, but I'm
not quite sure if I understand the concept correctly. At a first glance
it looks very similar to Avalon selectors.
E.g. if I instantiate two beans like this:
<bean name="myproject.Service/foo" … />
<bean name="myproject.Service/bar" … />
Is this sufficient for accessing the beans via the bean map?
<bean name="my-client-bean">
<property name="services">
<configurator:bean-map type="myproject.Service">
</property>
</bean>
Service foo = (Service) services.get("foo")
If this is correct, it would solve the problem of registering the beans
at runtime (IIUC this is the major purpose of the bean map?).
For my understanding: Would this be equivalent to getting the bean
directly from the app context?
Service foo = (…) context.getBean(Service.class.getName() + "/foo")
Of course this has the disadvantage that a dependency to Spring is
necessary.
Thanks again!
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01