Results 1 to 3 of 3

Thread: Null dependencies

  1. #1
    Join Date
    Feb 2010
    Posts
    14

    Default Null dependencies

    I have a Spring Roo project and here is what's occuring:

    1. I have a Service with Autowired dependencies
    2. The Service is also annotated to be a Webservice by CXF

    I have a breakpoint in the constructor of the service, as well as a setter method for one of the dependencies. During Spring init, the constructor is called twice, however the setter method is called once. I also wrote down the reference id for both instances.

    When I call my webservice, I get back an instance where dependencies are null. I am not sure what's up.

    The code is very basic, has anyone experiences something like this?

    Thanks

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    There are 2 instances one managed by spring (correctly injected) and one managed by CXF not injected because spring doesn't know about it. I suggest you investigate a better integration for Spring and CXF.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Feb 2010
    Posts
    14

    Default

    Quote Originally Posted by Marten Deinum View Post
    There are 2 instances one managed by spring (correctly injected) and one managed by CXF not injected because spring doesn't know about it. I suggest you investigate a better integration for Spring and CXF.
    Just looked back at the cxf config, looks like I was missing this part:

    If you want to reference a spring managed-bean, you can write like this:

    <bean id="hello" class="demo.spring.HelloWorldImpl" />

    <jaxws:endpoint id="helloWorld" implementor="#hello" address="/HelloWorld" />

    and only had this:

    <jaxws:endpoint
    id="helloWorld"
    implementor="demo.spring.HelloWorldImpl"
    address="/HelloWorld" />


    Thanks !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •