Skip to content

SpringDocJacksonModuleConfiguration is loaded even though there is no ObjectMapperProvider when springdoc.api-docs.enabled = false #2142

Closed
@davefranken-ah

Description

@davefranken-ah

Describe the bug
Caused by: #2114

Usually, Springdoc configuration classes include an annotation @ConditionalOnBean(SpringDocConfiguration.class), this ensures they are only loaded if the beans from that configuration are loaded.

SpringDocJacksonModuleConfiguration does not have such an annotation. Thus, the constructor inside it is fired, which requires a bean of type ObjectMapperProvider, which is not available when springdoc.api-docs.enabled = false.

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using? 3.0.4
  • What modules and versions of springdoc-openapi are you using? 2.0.4
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    There should not be an error
  • Provide with a sample code (HelloController) or Test that reproduces the problem
    In application.yml (or .properties), set springdoc.api-docs.enabled to false
    Try to start an application or run a test

Expected behavior
The application should start and/or tests should run

Additional context
This is likely caused by #2114 where the SpringDocJacksonModuleConfiguration was added without the proper annotations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions