Skip to content

object mapper conflict when importing springfox #890

Closed
@prabhat1790

Description

@prabhat1790

Hi All,
I am trying to configure springfox for my application and facing a issue related to _halObjectMapper bean. My application is getting one objectMapper bean from one library and one from springfox(or its dependencies) and therefore HypermediaAutoConfiguration class is unable to determine which bean to inject and throws up the exception -
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration$HypermediaConfiguration$HalObjectMapperConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.fasterxml.jackson.databind.ObjectMapper org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration$HypermediaConfiguration$HalObjectMapperConfiguration.primaryObjectMapper; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.fasterxml.jackson.databind.ObjectMapper] is defined: expected single matching bean but found 2: enginesMapper,_halObjectMapper
Is it possible to configure this injection by name in place of by type to resolve the issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions