我试图在春季启动时使用swagger 2,但我得到以下异常:
index.php
我的swagger配置类是:
org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.swagger.web.SecurityConfiguration]: Factory method 'security' threw exception; nested exception is java.lang.NoSuchMethodError: springfox.documentation.swagger.web.SecurityConfiguration.
我在我的pom中添加了以下两个依赖项:
@Configuration
@EnableSwagger2
public class SwaggerConfig{
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}