У меня есть пользовательская реализация EndpointInterceptor
;
@Component
public class MyEndpointInterceptor implements EndpointInterceptor {
@Autowired
private Jaxb2Marshaller marshaller;
@Override
public boolean handleRequest(MessageContext messageContext, Object o) throws Exception {
return true;
}
@Override
public boolean handleResponse(MessageContext messageContext, Object o) throws Exception {
return true;
}
@Override
public boolean handleFault(MessageContext messageContext, Object o) throws Exception {
return true;
}
@Override
public void afterCompletion(MessageContext messageContext, Object o, Exception e) throws Exception {
// ... do stuff with marshaller
}
}
Перехватчик добавлен в класс конфигурации, который расширяет WsConfigurerAdapter
;
@Configuration
@EnableWs
public class MyWebServiceConfiguration extends WsConfigurerAdapter {
@Bean(name = "marshaller")
public Jaxb2Marshaller createJaxb2Marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
return marshaller;
}
@Override
public void addInterceptors(List<EndpointInterceptor> interceptors)
{
// Register interceptor
interceptors.add(new MyEndpointInterceptor());
}
}
но объект marshaller
равен null
.
Есть ли что-то, чего мне не хватает в этот момент?