spring boot 3 and open api ‘swaggerWelcome’ threw exception

  Kiến thức lập trình

I have the following versions

id("org.springframework.boot") version "3.2.5"

implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0”)



@Configuration
public class OpenApiConfig {
    @Bean
    public OpenAPI springOpenAPI() {
        return new OpenAPI()
                .info(new Info().title("spring”)
                                .description("This service  runs.”)
                                .version("v0.0.1")
                )
                .externalDocs(new ExternalDocumentation()
                        .description(“pages”)
                        .url("https://pages”));
    }

}

I get the following exception i dont know why

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springdoc.webmvc.ui.SwaggerWelcomeWebMvc]: Factory method 'swaggerWelcome' threw exception with message: 'void org.springdoc.ui.AbstractSwaggerWelcome.<init>(org.springdoc.core.properties.SwaggerUiConfigProperties, org.springdoc.core.properties.SpringDocConfigProperties, org.springdoc.core.properties.SwaggerUiConfigParameters)'
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644)
    ... 217 more
Caused by: java.lang.NoSuchMethodError: 'void org.springdoc.ui.AbstractSwaggerWelcome.<init>(org.springdoc.core.properties.SwaggerUiConfigProperties, org.springdoc.core.properties.SpringDocConfigProperties, org.springdoc.core.properties.SwaggerUiConfigParameters)'
    at org.springdoc.webmvc.ui.SwaggerWelcomeCommon.<init>(SwaggerWelcomeCommon.java:54)
    at org.springdoc.webmvc.ui.SwaggerWelcomeWebMvc.<init>(SwaggerWelcomeWebMvc.java:77)
    at org.springdoc.webmvc.ui.SwaggerConfig.swaggerWelcome(SwaggerConfig.java:83)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140)
    ... 218 more

LEAVE A COMMENT