I want to configure AnnotationMethodHandlerExceptionResolver
by adding jackson message converter. The problem is that I have already configured message converters in <mvc:message-converters>
by creating a bean, and I can't reference it in AnnotationMethodHandlerExceptionResolver
neither use ref
in <mvc:message-conferters>
<mvc:annotation-driven>
<mvc:message-converters register-defaults="false">
<bean id="mappingJackson2" class="pl.styall.scylla.json.config.CustomMappingJackson2">
<property name="objectMapper" ref="jacksonObjectMapper" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<bean id="outboundExceptionAdapter"
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver">
<property name="messageConverters">
<list>
<ref bean="mappingJackson2" />
</list>
</property>
</bean>
I could define two beans one for <mvc:message-converters>
and AnnotationMethodHandlerExceptionResolver
, but it is probably not the best idea. Is there other way to do this?