Is there a way to get all registered message-converters?

Viewed 5804

I would like to somehow inject all HttpMessageConverter instances registered in Spring-MVC. I can successfully inject all that have been registered via.

private HttpMessageConverter[] converters;
@Autowired
public void setConverters(HttpMessageConverter[] converters) {
    this.converters = converters;
}

However this only injects if the converter was registered inside the context (i.e. if defined outside of <annotation-driven>).

I did figure I would try using <beans:ref inside the <annotation-driven><message-converters> but it is not supported in spring-web 3.1.

Is there some class I can inject that may have a property I could use to get converters? Ideally I'd like to see the order in the filter chain they are registered in too.

3 Answers
Related