That's what I figured and what I'm doing in development where I need to
specifically define the Mock Objects.  In production, I will autowire as
the previously mentioned performance issue is only at startup and not
really an issue for me given the size of my app right now. (see my other
response for more on performance.) 
 
anthony

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Kotek
Sent: Monday, June 11, 2007 4:56 PM
To: [email protected]
Subject: [coldspring-dev] Config/Inheritance Question


Yes, you're not setting things up correctly. What you're doing is having
ColdSpring create a single, separate instance of the BaseClass that has
the proper composed objects injected. But none of your other objects
have these injected. What you want is this: 



<beans> 
        <bean id ="ComposedClassA" class="path.to.ComposedClassA " /> 
        <bean id ="ComposedClassB" class="path.to.ComposedClassB " /> 
        <bean id ="MockComposedClassA" class=" path.to <http://path.to/>
.MockComposedClassA" /> 
        <bean id ="MockComposedClassb" class=" path.to <http://path.to/>
.MockComposedClassB" /> 
        <bean id ="SubClassA" class="path.to.SubClassA "> 
                <property name ="ComposedClassA" > 
                        <ref bean ="MockComposedClassA" /> 
                </property> 
                <property name ="ComposedClassB" > 
                        <ref bean ="MockComposedClassB" /> 
                </property> 
        </bean> 
        <bean id ="SubClassB" class="path.to.SubClassB "> 
                <property name ="ComposedClassA" > 
                        <ref bean ="MockComposedClassA" /> 
                </property> 
                <property name ="ComposedClassB" > 
                        <ref bean ="MockComposedClassB" /> 
                </property> 
        </bean> 
</beans > 

Hope that helps,

Brian


On 6/11/07, Anthony Israel-Davis <[EMAIL PROTECTED]> wrote: 


        I'm running into a problem and I don't know if it's a problem in
my code or a misunderstanding about how the Coldspring beanfactory wires
up components. I'm using version 1.1.1 .

        I have two subclasses that use components that are composed into
the base class. I'm unit testing using CFCUnit, but my tests are
returning errors saying "ComposedClassA is undefined in variables."
despite a setComposedClassA method in the base class. 

        My bean definition looks something like this: 

        <beans> 
                <bean id ="ComposedClassA" class="path.to.ComposedClassA
" /> 
                <bean id ="ComposedClassB" class="path.to.ComposedClassB
" /> 
                <bean id ="MockComposedClassA" class=" path.to
<http://path.to> .MockComposedClassA" /> 
                <bean id ="MockComposedClassb" class=" path.to
<http://path.to> .MockComposedClassB" /> 
                <bean id ="BaseClass" class="path.to.BaseClass "> 
                        <property name ="ComposedClassA" > 
                                <ref bean ="MockComposedClassA" /> 
                        </property> 
                        <property name ="ComposedClassB" > 
                                <ref bean ="MockComposedClassB" /> 
                        </property> 
                </bean> 
                <bean id ="SubClassA" class="path.to.SubClassA "/> 
                <bean id ="SubClassB" class="path.to.SubClassB " /> 
        </beans > 

        There are getters and setters in BaseClass for
ComposedClass(A-B), so my question is when I call
local.beanFactory.getBean('SubClassA') (which extends BaseClass) does
Coldspring call the BaseClass' setters? It seems to not call inherited
setters, but if, in the config file, I put the properties in SubClassA
it configures the bean correctly. 

        So am I doing something wrong or is Coldspring performing as
expected? I couldn't find anything in the documentation or in the forums
specifically about this, so any help would be appreciated. 

        Thanks, 
        anthony 


Reply via email to