|
From: Rod J. <ro...@in...> - 2004-10-04 20:52:03
|
Have to say that this looks to me like it's making a case for an = expression language instead of a FactoryBean.=20 A similar requirement that would also be well addressed by = OGNL/whatever: evaluating a constant. E.g. an AutowireCapableBeanFactory constant, = which I recently had to configure via a property. It would be nice to be able to = do that easily. Rgds Rod -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf = Of Colin Sampaleanu Sent: 04 October 2004 18:32 To: spr...@li... Subject: Re: [Springframework-developer] PropertyPathFactoryBean Good stuff. It overlaps of course with the mythical OGNL or expression support which keeps getting pushed back, but in the meantime provides = some of the benefits for pretty little extra code... j=FCrgen h=F6ller [werk3AT] wrote: >I've just added a PropertyPathFactoryBean, following this suggestion: > >http://opensource.atlassian.com/projects/spring/browse/SPR-343 > > >Usage examples: > > // target bean to be referenced by name <bean id=3D"tb"=20 > class=3D"org.springframework.beans.TestBean" singleton=3D"false"> > <property name=3D"age"><value>10</value></property> > <property name=3D"spouse"> > <bean class=3D"org.springframework.beans.TestBean"> > <property name=3D"age"><value>11</value></property> > </bean> > </property> > </bean> > > // will result in 12, which is the value of property 'age' of the=20 > inner bean <bean id=3D"propertyPath1" class=3D"org.springframework.beans.factory.config.PropertyPathFactoryBean= "> > <property name=3D"targetObject"> > <bean class=3D"org.springframework.beans.TestBean"> > <property name=3D"age"><value>12</value></property> > </bean> > </property> > <property name=3D"propertyPath"><value>age</value></property> > </bean> > > // will result in 11, which is the value of property 'spouse.age' of = bean 'tb' > <bean id=3D"propertyPath2" class=3D"org.springframework.beans.factory.config.PropertyPathFactoryBean= "> > <property name=3D"targetBeanName"><value>tb</value></property> > <property name=3D"propertyPath"><value>spouse.age</value></property> > </bean> > > // will result in 10, which is the value of property 'age' of bean = 'tb' > <bean id=3D"tb.age"=20 > = class=3D"org.springframework.beans.factory.config.PropertyPathFactoryBea > n"/> > > >The last one, interpreting the bean name as 'beanName.property' = pattern, is quite concise... > =20 > ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal = Use IT products in your business? Tell us what you think of them. Give us = Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |