spring-boot-starter-swagger icon indicating copy to clipboard operation
spring-boot-starter-swagger copied to clipboard

Conflict with spring-boot-starter-data-rest

Open alaahong opened this issue 7 years ago • 2 comments

利用 spring-boot-starter-data-rest暴露jpa接口后,swagger看不到相关API

http://localhost:9003/rest/repo/browser/index.html#/rest/repo 可以看到HAL BROWSER,并且可以查询出结果 04062

http://localhost:9003/swagger-ui.html#/ swagger能看到正常的RestController暴露的API,但是看不到spring-boot-starter-data-rest暴露的接口 04061

按照stackoverflow上若干整合 加上 springfox-data-rest也不起作用 https://stackoverflow.com/questions/22340357/swagger-with-spring-data-rest @Import(SpringDataRestConfiguration.class) https://reflectoring.io/documenting-spring-data-rest-api-with-springfox/ 这样会抛错误 org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NoSuchMethodError: org.springframework.data.repository.support.Repositories.getRepositoryInformationFor(Ljava/lang/Class;)Lorg/springframework/data/repository/core/RepositoryInformation;

相关配置: swagger.base-path=/**
spring.data.rest.base-path=/rest/repo spring.data.rest.detection-strategy=ANNOTATED

    <!-- API Doc -->
    <dependency>
        <groupId>com.spring4all</groupId>
        <artifactId>swagger-spring-boot-starter</artifactId>
        <version>1.7.0.RELEASE</version>
    </dependency> 
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-data-rest</artifactId>
        <version>2.8.0</version>
    </dependency>
<!-- SpringBoot 2.0.0.RELEASE -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-hateoas</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-rest-hal-browser</artifactId>
    </dependency>

`

alaahong avatar Apr 05 '18 16:04 alaahong

I've got the same problem. Did anyone find solution?

mocimy avatar May 28 '18 09:05 mocimy