我在使用API文档的Springfox swagger 2时遇到了麻烦。它无法识别我的其余存储库(JpaRepository / PagingAndSortingRepository)。
import org.springframework.data.jpa.repository.JpaRepository;
import com.aegon.dop.model.Book;
public interface BookRepository extends JpaRepository<Book, Long> {
}
Run Code Online (Sandbox Code Playgroud)
即使我尝试添加如下所示的招摇注解,但也没有运气
@Api(tags = "books")
@RepositoryRestResource(collectionResourceRel = "books", path = "books")
public interface BookRepository extends JpaRepository<Book, String> {
@ApiOperation("Find all books by book name")
Dopadviseur findByBookName(@Param("bookName") @RequestParam @ApiParam(value = "bookName") String bookName);
}
Run Code Online (Sandbox Code Playgroud)
而HAL浏览器可以识别我的其余存储库。有人可以帮我弄这个吗。这是我的pom依赖关系,
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Demo</name>
<description>Demo application</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties> …Run Code Online (Sandbox Code Playgroud)