Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8603887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:25:50+00:00 2026-06-12T02:25:50+00:00

Im using Spring MVC 3.1 which by default uses Jackson for JSON-Java conversions. I

  • 0

Im using Spring MVC 3.1 which by default uses Jackson for JSON-Java conversions.

I need to create custom conversions for the following:

  1. java.util.List (for all sorts of different types).
  2. Enums to strings
  3. java.util.Calendar

I have encountered a few different approaches for creating my custom converters:

  1. As described here more or less, create a custom ObjectMapper:

    public class CustomObjectMapper extends ObjectMapper…

Then adding MappingJacksonHttpMessageConverter to my servlet-context and register it with my custom ObjectMapper:

Then i guess I need to have some specific implementations in my custom objectMapper (how should it look like?).

  1. A second approach talks about extending FormattingConversionServiceFactoryBean and create my own converters (a class that implements org.springframework.core.convert.converter.Converter) as described here.

UPDATE 1:
Another approach I have seen is to subcalss MappingJacksonHttpMessageConverter and override getJavaType method, as described here. To do this I will have to add my custom converter to the list of converters:

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
    <list>
        <bean class="com.yl.app.CustomMappingJacksonHttpMessageConverter">
    </list>
</property>

Which approach is the recommended one? Are these the only ones, is there a better way of doing it?

UPDATE 2:

I still don’t get it. In practice, suppose I have class A and class B.

Class A holds a list of B:

public class A {

   public List<B> list;

}

I would like to return an object of type A to my client. What should I do in my server besides adding the @ResponseBody annotation (which is not enough in this case as far as I get it)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:25:51+00:00Added an answer on June 12, 2026 at 2:25 am

    After trying it myself, non of the listed approaches is required. Jackson (as is) is capable of handling nested Collections just fine, no customization required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Spring MVC project in which I'm using Hibernate Validator to
I'm using spring MVC, and I have a custom authentication/security system that I had
See the following Mock Test by using Spring/Spring-MVC public class OrderTest { // SimpleFormController
I have a REST web service using spring MVC which is external-facing. I would
I am using spring mvc in my application,when i created user i have to
I am using Spring MVC 3.1.x with Tiles 2.2.2 (bootstrapped project with Roo) and
I am using Spring MVC with Hibernate. My page has a button that creates
I am using spring MVC 3.0 with the jqgrid plugin. I am building the
I'm using Spring MVC and jquery autocomplete, my spring controller looks like this @RequestMapping(value
I'm using Spring's form tag library in a Spring MVC application that I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.