Spring MediaTypes Property 교체하기
Spring 3.1 -> 3.2로 가면서 ContentNegotitaingVeiwResolver 클래스의 setMediaTypes 메소드가 deprecated 되었습니다.
그래서 이참에 변경해보도록 합니다.
- 3.1 version
<beans:bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <beans:property name="order" value="1"></beans:property> <beans:property name="mediaTypes"> <beans:map> <beans:entry key="json" value="application/json"/> </beans:map> </beans:property> <beans:property name="defaultViews"> <beans:list> <beans:bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"> </beans:bean> </beans:list> </beans:property> </beans:bean>
- 3.2 version
<beans:bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <beans:property name="order" value="1"></beans:property> <beans:property name="contentNegotiationManager"> <beans:bean class="org.springframework.web.accept.ContentNegotiationManager"> <beans:constructor-arg> <beans:bean class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy"> <beans:constructor-arg> <beans:map> <beans:entry key="json" value="application/json"/> </beans:map> </beans:constructor-arg> </beans:bean> </beans:constructor-arg> </beans:bean> </beans:property> <beans:property name="defaultViews"> <beans:list> <beans:bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"></beans:bean> </beans:list> </beans:property> </beans:bean>
댓글 없음:
댓글 쓰기