OpenApi - 需要找不到类型 'org.springdoc.webmvc.ui.SwaggerIndexTransformer' 的 bean

OpenApi - required a bean of type 'org.springdoc.webmvc.ui.SwaggerIndexTransformer' that could not be found

我正在使用功能控制器将 Swagger 添加到我的 Spring Webflux 服务中。首先我收到这个错误:

Description: The bean 'swaggerWelcome', defined in class path resource [org/springdoc/webflux/ui/SwaggerConfig.class], could not be registered. A bean with that name has already been defined in class path resource [org/springdoc/webmvc/ui/SwaggerConfig.class] and overriding is disabled.

Action:

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

所以我将 spring.main.allow-bean-definition-overriding=true 添加到我的 application.properties 文件中。

现在我收到这个错误:

Description:

Parameter 1 of method swaggerWebMvcConfigurer in org.springdoc.webmvc.ui.SwaggerConfig required a bean of type 'org.springdoc.webmvc.ui.SwaggerIndexTransformer' that could not be found.

Action:

Consider defining a bean of type 'org.springdoc.webmvc.ui.SwaggerIndexTransformer' in your configuration.

Pom 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.company/groupId>
    <artifactId>service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

        <!-- For all mvc and web functions -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>

        <!-- Default persistence functions -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-r2dbc</artifactId>
        </dependency>

        <dependency>
            <groupId>dev.miku</groupId>
            <artifactId>r2dbc-mysql</artifactId>
            <version>0.8.2.RELEASE</version>
            <scope>runtime</scope>
        </dependency>
        
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.5.9</version>
        </dependency>

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-webflux-ui</artifactId>
            <version>1.5.9</version>
        </dependency>

    </dependencies>
</project>

application.properties 文件包含:

spring.main.allow-bean-definition-overriding=true

有没有办法避免这种配置? SwaggerIndexTransformer 的用途是什么?因为在网站 https://springdoc.org/#getting-started 他们说“不需要额外的配置”。

错误是在pom文件中唯一的依赖应该是springdoc-openapi-webflux-ui