티스토리 뷰

Spring

[Spring] json 메세지 컨버터 사용

IT공부블로그 2019. 8. 25. 17:35
728x90
반응형

pom.xml에 아래의 내용 추가

<dependency>

<groupId>com.fasterxml.jackson.core</groupId>

<artifactId>jackson-databind</artifactId>

<version>2.1.1</version>

</dependency>

spring-servlet.xml 에 아래의 내용 추가 

<mvc:annotation-driven> <!-- @EnableMvc -->

<mvc:message-converters>


<!-- json 메세지 컨버터 -->

<bean

class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">

<property name="supportedMediaTypes">

<list>

<value>application/json; charset=UTF-8</value>

</list>

</property>

</bean>


</mvc:message-converters>

</mvc:annotation-driven>


728x90
반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함