整合ssm时踩过的坑

Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.util.DefaultPrettyPrinter$Indenter

直接说原因 :

在Spring-mvc.xml这个配置文件中

我加了 json格式乱码处理, 但是在我的程序中暂时没有用到 json

<!--json格式乱码处理-->
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<constructor-arg value="UTF-8"/>
</bean>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper">
<bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean">
<property name="failOnEmptyBeans" value="false"/>
</bean>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>

所以解决办法: 直接注释 或者 删掉就好 解决ok

我还有一点不明白 注解驱动

这句代码 和 json格式乱码处理的代码 有什么关系

<!--注解驱动-->  
<mvc:annotation-driven/>

当时写的时候直接写的 json格式乱码处理 这个代码

以为这个代码能将两个都解决

目前还不明白

有大佬懂得 帮个忙 一起交流交流 QAQ