Christopher Barran wrote:
I have created a set of services that depend on each other.
ServiceA depends on ServiceB which depends on ServiceC

If I write a unit test that builds the HiveMind registry.
I can get out ServiceC and test it, works OK

If I get ServiceB and test it works OK.

If I get ServiceA and test it, fails because
ServiceB has no reference to ServiceC.

I guess this is something to do with proxies ?

When I get ServiceB from the registry a proxy is created for ServiceC
and when I use the service it is instanciated.

However when I get ServiceA from the registry a Singlton proxy is created for ServiceB but I see no such message about autowiring a Single ton proxy for ServiceC. When the code tries to access ServiceC I get a NullPointerException. Any ideas.

<?xml version="1.0" encoding="UTF-8"?>
<module id="myModule"  version="1.0.0">
    <service-point id="ServiceC" interface="foo.bar.ServiceC">
    <create-instance class="foo.bar.ServiceCImpl" />
  <interceptor service-id="hivemind.LoggingInterceptor"/>
  </service-point>

   <service-point id="ServiceB" interface="foo.bar.ServiceB">
    <invoke-factory service-id="hivemind.BuilderFactory">
    <construct class="foo.bar.ServiceBImpl" autowire-services="true" />
    </invoke-factory>
  <interceptor service-id="hivemind.LoggingInterceptor"/>
  </service-point>


  <service-point id="ServiceA" interface="foo.bar.ServiceA" >
    <invoke-factory service-id="hivemind.BuilderFactory">
      <construct class="foo.bar.ServiceAImpl" autowire-services="true">
       <set property="country" value="GB" />
       <set property="company" value="COMPANY" />
       <set property="url" value="http://www.foo.com"; />
       <set property="script" value="/foo/bar.jsp" />
      </construct>
    </invoke-factory>
    <interceptor service-id="hivemind.LoggingInterceptor"/>
  </service-point>
</module>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Maybe it is because you use create-instance for ServiceC?
Also you can skip service-id="hivemind.BuilderFactory" because it is default ( as autowire-services="true" )

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to