1. 程式人生 > >SpringMVC 添加 RestController 支持

SpringMVC 添加 RestController 支持

dispatch AS patch 添加 not ont sage stc code

1. 下載依賴包

http://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
http://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
http://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations

2. 修改 dispatcher-servlet.xml

<mvc:annotation-driven/>
<mvc:default-servlet-handler/>
<mvc:annotation-driven> <mvc:message-converters> <bean class="org.springframework.http.converter.StringHttpMessageConverter"/> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/> </mvc:message-converters> </mvc:annotation-driven>

SpringMVC 添加 RestController 支持