I wouldn't necessarily consider it an anti-pattern. Constructor injection is good when you need to document/demonstrate that a class must *not* be instantiated if it does not have those certain properties available. Of course, that can be rolled back to just using setter injection in areas where performance is crucial.
Glen Am Dienstag, den 25.03.2008, 16:45 -0400 schrieb Benson Margulies: > I'm not entirely sure that I believe it, but it appears that the following > bit of spring from cxf.xml is disproportionately expensive. Why? Because it > uses a contructor with arguments. Why? Because spring has to think much > harder to decide on a constructor than a set of set methods. > > So... I'm going to try adding set methods, a no-args constructor, and an > init-method, and see what I see. > > If this works, I'll be on the hunt for other cases of the same (anti????) > pattern. > > > <bean id="org.apache.cxf.resource.ResourceManager" class=" > org.apache.cxf.bus.resource.ResourceManagerImpl"> > <constructor-arg> > <list> > <bean class="org.apache.cxf.resource.ClasspathResolver"/> > <bean class="org.apache.cxf.resource.ClassLoaderResolver"/> > <bean class=" > org.apache.cxf.bus.spring.BusApplicationContextResourceResolver"/> > </list> > </constructor-arg> > <property name="bus" ref="cxf"/> > </bean>
