Announcement Announcement Module
Collapse
No announcement yet.
GatewayProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment


    • #3
      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?

      Comment


      • #4
        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.

        Comment


        • #5
          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

          Comment

          Working...
          X