0
        <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();
    }
}

This error occurs when the profile is not local-test or 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.

Hi, i'm using Swagger3.0 with Spring Data Rest.

This is the link I referenced. https://stackoverflow.com/a/46458135/10345277

What I'm doing is trying to turn the Swagger on or off by Profile.

However, unlike the above link, I use SDR and springfox.documentation.spring.data.rest throws an error.

Is there a solution?

윤현구
  • 467
  • 7
  • 19

2 Answers2

0

In my case - using io.springfox:springfox-swagger2:2.9.2 and io.springfox:springfox-swagger-ui:2.9.2 - this error war triggered because I forgot to add @EnableSwagger2 to my @Configuration class

electrobabe
  • 1,549
  • 18
  • 17
-1

my swagger3.0 is fine,like this:

@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();
}
Tom
  • 19
  • 1