Skip to content

Application that depends upon spring-boot-starter-web and spring-boot-starter-jersey fails to start due to attempt to override requestContextFilter bean #15048

@wilkinsona

Description

@wilkinsona

As reported in this question on Stack Overflow, an app that depends on both spring-boot-starter-web and spring-boot-starter-jersey will fail to start. It fails with the following output:

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'requestContextFilter', defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

There's, presumably, a bug or at least some unintended behaviour in 2.0 and perhaps 1.5 as well with the requestContextFilter bean being overridden. It fails hard on 2.1 due to bean overriding now being disabled by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: regressionA regression from a previous release

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions