<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-data-rest</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>@Profile({"dev-test", "local-test"})
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {
@Bean
public Docket documentation() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(s -> s.matches("/_api/.*"))
.build();
}
}当profile不是本地测试或dev-test.时,就会发生此错误。
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 4 of constructor in springfox.documentation.spring.data.rest.EntityServicesProvider required a bean of type 'com.fasterxml.classmate.TypeResolver' that could not be found.
Action:
Consider defining a bean of type 'com.fasterxml.classmate.TypeResolver' in your configuration.嗨,我使用的是Swagger3.0和Spring。
这是我引用的链接。https://stackoverflow.com/a/46458135/10345277
我所做的是试图打开或关闭的文件.
但是,与上面的链接不同,我使用特别提款权,springfox.documentation.spring.data.rest抛出一个错误。
有解决办法吗?
发布于 2022-04-06 10:04:37
在我的例子中--使用io.SpringFox:springfox-swagger 2:2.9.2和io.springfox:springfox-swagger-ui:2.9.2 -由于我忘记将@EnableSwagger2 2添加到我的@Configuration类中,引发了这个错误战争。
发布于 2019-05-24 09:41:14
我的swagger3.0很好,就像这样:
@ConditionalOnClass(value = {Swagger.class})
@Profile({"dev", "test"})
@Configuration
@EnableSwagger2
public class SwaggerConfig {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("your base package"))
.paths(PathSelectors.any())
.build();
}https://stackoverflow.com/questions/56288661
复制相似问题