Rest Template
servlet-context.xml 설정
스키마 설정
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
bean 설정
// RestTemplate bean 등록
<beans:bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
<util:list>
<beans:bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
//카멜케이스를 언더스코어로 받기위해 objectMapper 사용
<beans:property name="objectMapper">
<beans:ref bean="objectMapper"/>
</beans:property>
</beans:bean>
<beans:bean class="org.springframework.http.converter.FormHttpMessageConverter">
</beans:bean>
</util:list>
</beans:property>
</beans:bean>
//카멜케이스를 언더 스코어로 해주는 bean 등록
<beans:bean id="objectMapper" class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean" autowire="no">
<beans:property name="propertyNamingStrategy" value="CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES" />
</beans:bean>
'Programming > springFramework' 카테고리의 다른 글
[Tomcat] Error org.springframework.web.context.ContextLoader (0) | 2016.08.30 |
---|---|
[SpringFrameWork] 스프링 컨트롤러 map타입 으로 받기 (0) | 2016.05.17 |
[Spring FrameWork] Maven install 시 ERROR (0) | 2016.05.11 |
[Mybatis] 스프링 + 트랜잭션 (0) | 2016.04.18 |
[SpringFramework] POST 전송시 ContentType (0) | 2016.03.04 |