Results 1 to 5 of 5

Thread: GatewayProxyFactoryBean

  1. #1
    Join Date
    Nov 2008
    Location
    Swansea, Wales
    Posts
    202

    Question GatewayProxyFactoryBean

    I'm using GatewayProxyFactoryBean with great success however i'm doing

    Code:
    yammerMessageService = (YammerMessageService) context.getBean("yammerMessageService");
    Can these proxies be used with @AutoWired? I tried but with not much success. Maybe my config was wrong, just checking if it's possible and if any one has done it?

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    You should be able to use that with @Autowired since it is *just a bean*. Maybe you are having an issue with multiple beans implementing that same interface? Can you describe the errors that are preventing you from autowiring?

  3. #3
    Join Date
    Nov 2008
    Location
    Swansea, Wales
    Posts
    202

    Default

    I just get a null pointer exception, the auto wiring isnt happening.

    In my config i've switched on <context:annotation-config /> which I believe is reqiured for @autowired to work. But then havnt you got to switch on <context:component-scan /> too and that looks for beans annotated with @component, @service etc to auto wire? If I'm right then what is the base package of the proxy that get's created?

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    You don't need the 'component-scan' element unless you want the bean that you are *autowiring into* to be picked up automatically.

    If you have a <bean/> element for the target (the one that has a setter expecting the gateway's interface) and the <gateway/> element, then <context:annotation-config/> should be sufficient.

  5. #5
    Join Date
    Nov 2008
    Location
    Swansea, Wales
    Posts
    202

    Lightbulb

    Ahhh you've just given me a clue to my own stupidity! The class i'm wiring into isnt a Spring managed bean, it loads the context..........doh! Sorry for wasting your time! Still, it has solved my mystery

Posting Permissions

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