使用Jackson配置Spring MVC和JSON [英] Configuration of Spring MVC and JSON using Jackson

查看:312
本文介绍了使用Jackson配置Spring MVC和JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在和杰克逊一起使用Spring MVC。它需要< mvc:annotation-driven /> 。它适用于它但它带来了其他问题。例如,在添加< mvc:annotation-driven /> 后,Locale Change拦截器无法正常工作:

I'm using Spring MVC with Jackson. It requires <mvc:annotation-driven />. It works with it but it brings other issues. For example, after adding <mvc:annotation-driven />, Locale Change interceptor is not working:

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    <property name="interceptors">
        <list>
            <ref bean="localeChangeInterceptor" />
        </list>
    </property>
</bean>

除杰克逊外我不需要它,是否可以在没有<$ c $的情况下使用它c>< mvc:annotation-driven /> ?如果是这样,怎么样?

I don't need it except for Jackson, is it possible to use it without <mvc:annotation-driven />? If so, how?

谢谢

推荐答案

尝试使用mvc命名空间声明你的拦截器

try using mvc namespace to declare your interceptor

<mvc:interceptors>
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors>

这篇关于使用Jackson配置Spring MVC和JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆