0

I am using open api to generate the swagger docs, I follow the official documents to config like this:

package misc.config.openapi;

import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * https://springdoc.org/
 * https://github.com/springdoc/springdoc-openapi
 */
@Configuration
public class OpenApiConfig {

    @Bean
    public GroupedOpenApi fortuneApi() {
        return GroupedOpenApi.builder().group("Fortune").pathsToMatch("/fortune/**").build();
    }

}

this is the docs page. when I compile the project, shows error like this:

> Configure project :dolphin-acientbay
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Configure project :dolphin-post
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Configure project :dolphin-template
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Task :dolphin-common:compileJava FAILED
/Users/xiaoqiangjiang/source/reddwarf/backend/retire/dolphin-common/src/main/java/misc/config/openapi/OpenApiConfig.java:16: error: cannot find symbol
        return GroupedOpenApi.builder().group("Fortune").pathsToMatch("/fortune/**").build();
                                       ^
  symbol:   method group(String)
  location: class Builder
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dolphin-common:compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2s
9 actionable tasks: 6 executed, 3 up-to-date

the Intellij IDE did not give any error tips, why could not compile the project? what should I do to fixed this problem? Am I missing something? this is the dependencies I am using:

api "org.springdoc:springdoc-openapi-ui:1.6.9"
api "org.springdoc:springdoc-openapi-webmvc-core:1.2.32"
Helen
  • 87,344
  • 17
  • 243
  • 314
Dolphin
  • 29,069
  • 61
  • 260
  • 539

0 Answers0