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

  • SEARCH
  • Home
  • 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 7551439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:29:41+00:00 2026-05-30T10:29:41+00:00

Can I specify the Jackson ObjectMapper that Spring’s RestTemplate uses? I’m not 100% that’s

  • 0

Can I specify the Jackson ObjectMapper that Spring’s RestTemplate uses?

I’m not 100% that’s what I need to do but see below for details.

Background:
With help from this StackOverflow post I added @JsonFilter to my domain class and edited my jax-rs web service (implemented in CXF). I’m now successfully able to dynamically select which domain class fields to return in my RESTful API. So far so good.

I’m using Spring’s RestTemplate in my JUnit tests to test my RESTful API. This was working fine until I added @JasonFilter to my domain class. Now I’m getting the following exception:

org.springframework.web.client.ResourceAccessException: I/O error: Can not resolve BeanPropertyFilter with id ‘apiFilter’; no FilterProvider configured; nested exception is org.codehaus.jackson.map.JsonMappingException: Can not resolve BeanPropertyFilter with id ‘apiFilter’; no FilterProvider configured

at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453)

rest of stack trace omitted for brevity

Caused by: org.codehaus.jackson.map.JsonMappingException: Can not resolve BeanPropertyFilter with id ‘apiFilter’; no FilterProvider configured

at org.codehaus.jackson.map.ser.BeanSerializer.findFilter(BeanSerializer.java:252)

I was getting a similar problem on the server side and was able to resolve it (with help from this post) by giving a FilterProvider to the Jackson ObjectMapper as follows:

ObjectMapper mapper = new ObjectMapper();
FilterProvider filters = new SimpleFilterProvider().addFilter("apiFilter", SimpleBeanPropertyFilter.filterOutAllExcept(filterProperties));

Can I do something similar on the RestTemplate side? Any ideas of how to solve this issue are appreciated.

Just to be clear, on the client RestTemplate side I do not want to filter the domain object properties at all.

  • 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-05-30T10:29:43+00:00Added an answer on May 30, 2026 at 10:29 am

    Can I specify the Jackson ObjectMapper that Spring’s RestTemplate uses?

    I was able to force RestTemplate to use a customized ObjectMapper by doing the following:

    ObjectMapper mapper = new ObjectMapper();
    
    // set a custom filter
    Set<String> filterProperties = new HashSet<String>();
    FilterProvider filters = new SimpleFilterProvider().addFilter("apiFilter", SimpleBeanPropertyFilter.serializeAllExcept(filterProperties));
    mapper.setFilters(filters);
    
    MappingJacksonHttpMessageConverter messageConverter = new MappingJacksonHttpMessageConverter();
    messageConverter.setObjectMapper(mapper);
    List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
    messageConverters.add(messageConverter);
    restTemplate.setMessageConverters(messageConverters);
    

    This website provided example for part of the above code.

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

Sidebar

Related Questions

I see that i can specify this behavior in xml by using the following:
I understand in Entity Framework you can specify relationships that need to be joined
I see you can specify Insert, Update and Delete stored procs, but no straightforward
I understand that I can specify system properties to Tomcat by passing arguments with
In code one can specify globally accessible constants/enums/etc once that can then be reused
I know I can specify a node another document using XPointer: http://www.google.com/#xpointer(...) But, can
I can see how you can specify Tool Locations on a Jenkins slave node
I know I can specify it in the configuration XML, but I'd like to
I need help on how i can specify an array name or key using
You can specify equations using <equation> and also several others, but what tag must

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.