티스토리 뷰

eGovFrame3.6 버전 스프링 4.1.2에서 jackson(json) 사용 시 에러가 납니다.

 

 

답변

 

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
32
33
34
35
36
37
38
spring 4.1.x 이상부터 deprecated되어서 data bind로 변경이 필요합니다.
버전 업그레이드에 따른 dependency 이슈 문제 입니다.
 
1)
- BEFORE
<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>
 
-AFTER
<dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>2.4.3</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.4.3</version>
</dependency>
 
2. context-xxxx.xml(MappingJacksonJsonView가 선언된 xml파일) 에러 아래와 같이 변경
-BEFORE
 <bean id="jsonView" class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" >
        <property name="extractValueFromSingleKeyModel" value="true"/>
 </bean>
 
-AFTER
    <bean id="jsonView" class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
        <property name="contentType" value="text/html;charset=UTF-8"/>
    </bean>
cs
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/12   »
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
글 보관함