Maven項目中調用ResponseBody註解問題

在代碼中調用ResponseBody註解進行jasn注入,引入jackson包後出現問題,Request processing failed; nested exception is java.lang.IllegalArgumentException: No converter found for return value of type: class com.pawn.ssm.bean.Msg,刪掉導入的jackson包依然報這個錯誤,錯誤緣由,導入的jackson包未起做用,解決方法,在mvc配置文件中添加對<mvc:annotation-driven />的註解,添加內容爲html

1         <mvc:message-converters>
2             <bean class="org.springframework.http.converter.StringHttpMessageConverter">
3                 <property name="supportedMediaTypes">
4                     <list>
5                         <value>text/plain;charset=UTF-8</value>
6                     </list>
7                 </property>
8             </bean>
9         </mvc:message-converters>

問題得以解決,java

參考資料https://www.cnblogs.com/shuo1208/p/5552134.htmlspring

相關文章
相關標籤/搜索