2017-12-15 14 views
2

jsonView를 사용하기 위해 다음과 같은 설정을했습니다.왜 'net.sf.json.spring.web.servlet.view.JsonView'클래스를 찾을 수 없습니까?

디스패처-serlvet.xml :

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xsi:schemaLocation="http://www.springframework.org/schema/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc-4.1.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-4.1.xsd"> 

<bean id="jsonView" class="net.sf.json.spring.web.servlet.view.JsonView"> 
      <property name="contentType" value="application/json;charset=UTF-8" /> 
     </bean> 
</beans> 

의 pom.xml 그러나, 다음과 같은 오류가 디스패처-sevlet.xml에서 발생

<dependency> 
    <groupId>net.sf.json-lib</groupId> 
    <artifactId>json-lib</artifactId> 
    <version>2.4</version> 
    <classifier>jdk15</classifier> 
</dependency> 

:

Multiple annotations found at this line: 
- Class 'net.sf.json.spring.web.servlet.view.JsonView' not found 
- Class 'net.sf.json.spring.web.servlet.view.JsonView' not found [config set: rachelivf/web- 
context] 

I 돈 왜 이런 일이 일어나는 지 알 수 없습니다. 초보자는 대답이 필요합니다. 그 문제를 해결하는 방법을 알려주십시오.

답변

1

문제가 해결되었습니다.

내가 dispacther-servlet에 대해 쓴 내용은 오래되었습니다.

코드는

(dispacther-serlvet.xml)를 판독하도록 변형되었다 : 결과

<bean id="jsonView" class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"> 
    <property name="contentType" value="application/json;charset=UTF-8"/> 
</bean> 

는, 에러가 없어.