How can i check if the code is indeed running in a spring context?

2012/6/5 Ted <[email protected]>:
> I ran into the same problem a while ago, I found that the interceptor was
> not in the spring context. As a result I had to manually retrieve a
> reference to the context and get the spring beans that way.
>
> You might want to double check that the running code is in a spring
> context, I suspect you might find it's not. Remember, just because
> component scan initialises a copy of the bean, doesn't mean the running
> copy of the bean is from the context.
>
> On Tue, Jun 5, 2012 at 7:15 AM, Marco Pas <[email protected]> wrote:
>
>> Hi there,
>>
>> 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.
>> 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());
>>    }
>>
>> }
>>
>
>
>
> --
> Ted.

Reply via email to