Skip to content

With both Jackson 2 and 3 on the classpath, @JsonTest fails due to duplicate jacksonTesterFactoryBean #48198

@goafabric

Description

@goafabric

When using the "funky" combination of

  • Spring Boot 4.0 (RC2)
  • AOT Test Processing
  • @jsontest
  • Legacy spring-boot-jackson2 dependency

We get the following error below.
This may be a drastic combination, but its currently used in some of our projects.
Removing spring-boot-jackson2 solves the issue.

The problem persists in latest SNAPSHOT (20.11.2025)

Minimal Producer is attached.

Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'jacksonTesterFactoryBean' defined in class path resource [org/springframework/boot/jackson2/autoconfigure/Jackson2TesterTestAutoConfiguration.class]: Cannot register bean definition [Root bean: class=null; scope=prototype; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; fallback=false; factoryBeanName=org.springframework.boot.jackson2.autoconfigure.Jackson2TesterTestAutoConfiguration; factoryMethodName=jacksonTesterFactoryBean; initMethodNames=null; destroyMethodNames=[(inferred)]; defined in class path resource [org/springframework/boot/jackson2/autoconfigure/Jackson2TesterTestAutoConfiguration.class]] for bean 'jacksonTesterFactoryBean' since there is already [Root bean: class=null; scope=prototype; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; fallback=false; factoryBeanName=org.springframework.boot.jackson.autoconfigure.JacksonTesterTestAutoConfiguration; factoryMethodName=jacksonTesterFactoryBean; initMethodNames=null; destroyMethodNames=[(inferred)]; defined in class path resource [org/springframework/boot/jackson/autoconfigure/JacksonTesterTestAutoConfiguration.class]] bound.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions