2016/05/10

Jackson JsonView가 작동하지 않을 때

JsonView가 작동하지 않는 상황이 발생했다.
참... 어쩜 이렇게 뭐가 안되는 상황은 죄다 한번씩 겪어 보는지..
늘 그래왔듯이 검색 그리고 해결.

  • Jackson JsonView not being applied

  • 등록된 답변 보다도 답변에 추가된 Eric의 댓글이 포인트.
    Good catch regarding withView() not mutating the existing config. However, objectMapper.setConfig(objectMapper.getSerializationConfig().withView(YourView.‌​class)); works and is probably prefarable to subclassing ObjectMapper. work fine. thx.

    댓글 없음:

    댓글 쓰기