|
From: Oliver H. <Ol...@ou...> - 2004-06-27 23:11:48
|
I also believe that interface injection is a valid pattern and should be =
supported explicitly by the mapping docs. It seems a pity that Spring =
uses Type 1 under the covers (the Bean*Aware interfaces come to mind) =
but has no support for specifying custom interface injection.
Couldn't it be added quite simply through an extension of the root/child =
support?
With the current support you can do this:
<bean id=3D"org.whatever.Interface" class=3D"org.whatever.Interface">
<property name=3D"a"><value>1</value></property>
<property name=3D"b"><value>2</value></property>
</bean>
=20
<bean id=3D"implementingBean" class=3D"org.whatever.InterfaceImpl"
parent=3D"org.whatever.Interface" />
But would it be possible to implement a BeanFactoryPostProcessor that =
could detect any beans that implement org.whatever.Interface and =
automatically apply the parent attribute to them?=20
> -----Original Message-----
> From: spr...@li...=20
> [mailto:spr...@li...]
> On Behalf Of James Cook
> Sent: Monday, 28 June 2004 12:43 AM
> To: spr...@li...
> Subject: RE: [Springframework-developer] IoC container enhancements
>=20
>=20
> Well, I will argue it a bit :-)
>=20
> We use it to simplify the mapping of our DAO's to our web=20
> tier by making our servlet actions implement a DAOAware=20
> interface. It is extremely convenient to implement an=20
> interface and get the mapping for free. It is one step more=20
> explicit than autowire-by-type which I like. (Too much magic=20
> on large projects can create very difficult to debug=20
> scenarios.) It helps minimize the size of our Spring=20
> configuration, and it *works*.
>=20
> I'm too close to the solution to notice "any oddness" in its=20
> configuration
> :-) Without some additional framework support, I don't see=20
> any other way to do it now. The single property<->value=20
> relationship in that configuration could be expanded to take=20
> a collection of property<->value relationships in order to=20
> support multiple setters in a single interface.
>=20
> It's OK if you don't want to internalize it into the=20
> framework since it is obviously supported now in some=20
> fashion. If you did come up with some way to internalize it,=20
> perhaps it wouldn't get used much, I don't know. I know our=20
> team greatly appreciates the convenience.
>=20
> > -----Original Message-----
> > From: spr...@li...
> > [mailto:spr...@li...] On=20
> > Behalf Of j=FCrgen h=F6ller [werk3AT]
> > Sent: Friday, June 25, 2004 1:19 PM
> > To: spr...@li...
> > Subject: Re: [Springframework-developer] IoC container enhancements
> >=20
> > While this would be easy enough to add, I doubt that many=20
> people will=20
> > use it. IMHO, it feels a bit odd to first implement an=20
> interface that=20
> > specifies a setter and then still apply the property value via a=20
> > "property" key (which has to match the bean property of the=20
> setter in=20
> > the interface).
> >=20
> > If we do magic anyway, why not assume that the injection interface=20
> > specifies a single method with a single parameter? We could then=20
> > invoke that method with the specified argument value. This would at=20
> > least remove the "property" redundancy.
> >=20
> > I understand that this was the first way of IoC that XWork/WebWork2=20
> > supported, but I'm not convinced that it is really=20
> recommendable. Feel=20
> > free to argue about that :-)
> >=20
> > Juergen
> >=20
> >=20
> > ________________________________
> >=20
> > Von: spr...@li...=20
> im Auftrag=20
> > von James Cook
> > Gesendet: Fr 25.06.2004 15:40
> > An: spr...@li...
> > Betreff: RE: [Springframework-developer] IoC container enhancements
> >=20
> >=20
> >=20
> > Since you are enhancing the injection support for the container, do=20
> > you think it is worthwhile adding syntax to support Type 1=20
> (Interface
> > Injection)
> > IoC?
> >=20
> >=20
> http://opensource.atlassian.com/confluence/spring/display/DISC/Adding+
> > Inte
> > rf
> > ace+Injection+to+Spring
> >=20
> >=20
> >=20
> >=20
> > > -----Original Message-----
> > > From: spr...@li...
> > > [mailto:spr...@li...] On=20
> > > Behalf Of Rod Johnson
> > > Sent: Friday, June 25, 2004 3:50 AM
> > > To: spr...@li...
> > > Subject: Re: [Springframework-developer] IoC container=20
> enhancements
> > >
> > > > Lookup methods can be combined with Setter Injection.=20
> They can't=20
> > > > presently be combined with Constructor Injection, but I=20
> will add=20
> > > > support for this, assuming that it's possible with CGLIB.
> > >
> > >
> > > I've just removed this restriction.
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email sponsored by Black Hat Briefings & Training.
> > > Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> > > digital self defense, top technical experts, no vendor pitches,
> > > unmatched networking opportunities. Visit www.blackhat.com
> > > _______________________________________________
> > > Springframework-developer mailing list
> > > Spr...@li...
> > >=20
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >=20
> >=20
> >=20
> >=20
> > -------------------------------------------------------
> > This SF.Net email sponsored by Black Hat Briefings & Training.
> > Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> > digital self defense, top technical experts, no vendor pitches,
> > unmatched networking opportunities. Visit www.blackhat.com
> > _______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> >=20
> https://lists.sourceforge.net/lists/listinfo/s> =
pringframework-developer
> >=20
> >=20
> >=20
> >=20
> > -------------------------------------------------------
> > This SF.Net email sponsored by Black Hat Briefings & Training.
> > Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> > digital self defense, top technical experts, no vendor pitches,
> > unmatched networking opportunities. Visit www.blackhat.com
> > _______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> >=20
> https://lists.sourceforge.net/lists/listinfo/s> =
pringframework-developer
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 -=20
> digital self defense, top technical experts, no vendor pitches,=20
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>=20
|