You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Do...@atosorigin.com on 2007/08/30 11:26:12 UTC

Problems with DI and CXF

Dear all,

At the moment I havew my first try with CXF. Until now In just work with
Xfire. I wrote a simple Serverapplication in a Spring context. There is
a Interface-Class and a Implementation of this Interface-class. For the
methods in the implementation I need somd injected depencies out of the
spring context.I declared the serivice like this:

<jaxws:endpoint id="categoryService"
	
implementor="biz.dominiqueronde.argentum.server.provider.CategoryProvide
r"
	address="/CategoryService">
</jaxws:endpoint>

And I add a bean like this:

<bean id="categoryService"
	
class="biz.dominiqueronde.argentum.server.provider.CategoryProvider">

	<property name="hibernateTemplate">
		<ref bean="hibernateTemplate" />
	</property>
</bean>

But I get a null exception everytime I try to access the injected
hibernateTemplate.

Can you give me a hint?

Greetings
Dominique

Atos Origin GmbH, Theodor-Althoff-Str. 47, D-45133 Essen, Postfach 100 123, D-45001 Essen
Telefon: +49 201 4305 0, Fax: +49 201 4305 689095, www.atosorigin.de
ING Bank AG, Frankfurt/Main: Konto 001 014 0937, BLZ 500 210 00, Swift / BIC INGBDEFF, IBAN DE74 5002 1000 0010 1409 37
Gesch�ftsf�hrer: Dominique Illien, Handelsregister Essen HRB 19354, Ust.-ID.-Nr.: DE147861238


Re: Problems with DI and CXF

Posted by Willem2 <ni...@iona.com>.
Hi,

If you use the <jaxws:endpoint> 's implementor attribute to describe the
implementor which just a ref bean, you need to use the # as the prefix of
the bean's name.
So in your case, the <jaxws:endpoint> should look like this.

<jaxws:endpoint id="categoryService"	
implementor="#categoryService"
	address="/CategoryService">
</jaxws:endpoint>

or 
<jaxws:endpoint id="categoryService" address="/CategoryService">
  <jaxws:implementor> 
     <bean ref="categoryService" />
 </jaxws:implementor>
</jaxws:endpoint>


Willem.


Dominique.Ronde wrote:
> 
> Dear all,
> 
> At the moment I havew my first try with CXF. Until now In just work with
> Xfire. I wrote a simple Serverapplication in a Spring context. There is
> a Interface-Class and a Implementation of this Interface-class. For the
> methods in the implementation I need somd injected depencies out of the
> spring context.I declared the serivice like this:
> 
> <jaxws:endpoint id="categoryService"
> 	
> implementor="biz.dominiqueronde.argentum.server.provider.CategoryProvide
> r"
> 	address="/CategoryService">
> </jaxws:endpoint>
> 
> And I add a bean like this:
> 
> <bean id="categoryService"
> 	
> class="biz.dominiqueronde.argentum.server.provider.CategoryProvider">
> 
> 	<property name="hibernateTemplate">
> 		<ref bean="hibernateTemplate" />
> 	</property>
> </bean>
> 
> But I get a null exception everytime I try to access the injected
> hibernateTemplate.
> 
> Can you give me a hint?
> 
> Greetings
> Dominique
> 
> Atos Origin GmbH, Theodor-Althoff-Str. 47, D-45133 Essen, Postfach 100
> 123, D-45001 Essen
> Telefon: +49 201 4305 0, Fax: +49 201 4305 689095, www.atosorigin.de
> ING Bank AG, Frankfurt/Main: Konto 001 014 0937, BLZ 500 210 00, Swift /
> BIC INGBDEFF, IBAN DE74 5002 1000 0010 1409 37
> Geschäftsführer: Dominique Illien, Handelsregister Essen HRB 19354,
> Ust.-ID.-Nr.: DE147861238
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-with-DI-and-CXF-tf4353029.html#a12408313
Sent from the cxf-user mailing list archive at Nabble.com.