You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Springfox 2.2.2 in a Spring Boot 1.3.0.M4 application. I have configured a custom ObjectMapper bean and marked it as primary. However, springfox doesn't recognize it and shows some default mappings.
@Bean
@Primary
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule(), new MoneyModule());
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
return mapper;
}
I have read all the issues regarding this here and also I've read the description on the website about configuring the OM, but I can't find a working solution. I tried to register a ApplicationListener<ObjectMapperConfigured> listener and I debugged that I receive two OM instances, the first one being the one I have configured and the second some default one. I tried to apply the same configurations in the listener (on both mappers), but the types continue to be shown as if I use a non-configured default ObjectMapper.
The text was updated successfully, but these errors were encountered:
@milanov yeah this is probably the hardest problem that we've been trying to solve, can never get it quite right. Any ideas on how to solve it for your use case? PR perhaps?
I don't know if this is related, but i had an issue with SpringBoot and object mapper. It turned out that my application was initializing spring boot twice and causing lots of problems with springfox. In my Application onStartup() method, i created a servlet and then called super.onStartup() which caused the problem. After fixing that it resolved all my object mapper issues.
If you see the "Spring Boot" ascii banner displayed twice you might have the same issue.
I'm using Springfox 2.2.2 in a Spring Boot 1.3.0.M4 application. I have configured a custom
ObjectMapper
bean and marked it as primary. However, springfox doesn't recognize it and shows some default mappings.I have read all the issues regarding this here and also I've read the description on the website about configuring the OM, but I can't find a working solution. I tried to register a
ApplicationListener<ObjectMapperConfigured>
listener and I debugged that I receive two OM instances, the first one being the one I have configured and the second some default one. I tried to apply the same configurations in the listener (on both mappers), but the types continue to be shown as if I use a non-configured default ObjectMapper.The text was updated successfully, but these errors were encountered: