Organizational Research By

Surprising Reserch Topic

how to use spring autowired in a custom cxf interceptor


how to use spring autowired in a custom cxf interceptor  using -'web-services,spring,dependency-injection,cxf'

i seem to run into a small issue when using @Autowired into a custom cxf interceptor.
My use case is that i want to log soap messages and send these using AMQP to another system. This process works for normal services etc.
But whatever i do, the needed properties do not get autowired and stay null.

I checked the Spring DI log and the context is scanned and pickedup, so what am i missing?

Is this even possible in CXF interceptors?

@Component
public class LogInInterceptor extends AbstractSoapInterceptor {

    private @Value("#{rabbitMQProperties['rabbitmq.binding.log.soap']}")
    String binding;

    @Autowired
    AmqpTemplate amqpTemplate;

    public LogInInterceptor() {
        super(Phase.RECEIVE);
    }

    @Override
    public void handleMessage(SoapMessage soapMessage) throws Fault {
        logIt(soapMessage);
    }

    private void logIt(SoapMessage message) throws Fault {
        // rest of the code omitted...!!!     
        amqpTemplate.convertAndSend(binding, buffer.toString());
    }

}

    
asked Sep 14, 2015 by BradyBurbidg
0 votes
41 views



Related Hot Questions



Government Jobs Opening


...