Autowiring only works if there is exactly one service which matches the
property type.  So, if you only have moduleA, it might get wired just fine.
But, when you throw moduleB into the mix, it messes it up since it adds
another service point which implements the same interface as the previously
autowired property.


-----Original Message-----
From: Shing Hing Man [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 12, 2006 10:23 AM
To: HiveMind
Subject: autowiring problem 

My hivemodule.xml is divided into two submodules.
hivemodule.xml  :

<?xml version="1.0"?>

<module id="autowireTest" version="1.0.0">
    <sub-module descriptor="hivemoduleA.xml"/>
     <sub-module descriptor="hivemoduleB.xml"/>
</module> 


The hivemoduleA.xml has a service helloMessageSp with
the property 
greetingHolder autowaired by hiveMind. hivemouldeB.xml
is a 'copy of' hivemoduleA.xml.


hivemoduleA.xml :
  <?xml version="1.0"?>

<module id="autowireTestA" version="1.0.0">

    <service-point id="helloMessageSP"
interface="man.IHelloMessage">
        <invoke-factory >
                        <construct class="man.HelloMessage"/>           
         </invoke-factory>      
    </service-point>
                        
         <service-point id="greetingHolderSP"
interface="man.IGreetingHolder">
        <invoke-factory >
            <construct class="man.GreetingHolder">
                                  <set property="greeting"  value="Hello set
in
hivemoduleA.xml."/> 
                   </construct>
         </invoke-factory>      
    </service-point>
        
</module> 


hivemoduleB.xml is same as hivemoduleB.xml, but  with
a different greeting message set in service
greetingHolder2SP.
hivemoduleB.xml :

<?xml version="1.0"?>

<module id="autowireTestB" version="1.0.0">

         <service-point id="helloMessage2SP"
interface="man.IHelloMessage">
        <invoke-factory >
                        <construct class="man.HelloMessage"/>

         </invoke-factory>      
    </service-point>
        
                
         <service-point id="greetingHolder2SP"
interface="man.IGreetingHolder">
        <invoke-factory >
            <construct class="man.GreetingHolder">
                                  <set property="greeting"  value="Hello set
in
hivemoduleB.xml."/> 
                   </construct>
         </invoke-factory>      
    </service-point>
        
</module> 


The problem is that the autowiring to inject 
service greetingHolderSP  to service helloMessageSP,
service greetingHolder2SP  to service helloMessage2SP,
do not work.(ie the property greetingHolder in
helloMessageSP and helloMessage2SP are null.)

It would be appreciated if someone can give me a
pointer.
I have read about the limitation of autowring in the
documentation but not sure it applies to above.

Shing 


Home page :
  http://uk.geocities.com/matmsh/index.html


                
___________________________________________________________ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" -
The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html


Reply via email to