Configuration of Spring MVC and JSON using Jackson

2019-08-06 09:16发布

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>

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

Thanks

1条回答
小情绪 Triste *
2楼-- · 2019-08-06 09:25

try using mvc namespace to declare your interceptor

<mvc:interceptors>
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors>
查看更多
登录 后发表回答