SPRING 4에서 @ResponseBody 사용시 아래 오류가 발생할 경우 해결 :
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
pom.xml 에서 아래 내용 삭제
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
아래 내용 추가
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<version>2.4.4</version>
</dependency>
dispatcher-servlet.xml 내용 수정
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" /><bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="false" />
<property name="favorParameter" value="true" />
<property name="mediaTypes" >
<value>
json=application/json
xml=application/xml
</value>
</property>
</bean>
'JAVA > Spring(eGovFrame)' 카테고리의 다른 글
Spring4 JavaConfig 설정 - CommonConfig.java (0) | 2015.04.23 |
---|---|
Spring4 JavaConfig 설정 - WebMvcConfig.java (3) | 2015.04.23 |
Spring4 JavaConfig 설정 - WebInitializer.java (0) | 2015.04.22 |
Spring4 JavaConfig 설정 - 환경설정 (0) | 2015.04.22 |
Spring4 JavaConfig 설정 - 폴더 구조 (0) | 2015.04.22 |