Spring boot 为什么SpringFox没有公开@RepositoryRestResource?

Spring boot 为什么SpringFox没有公开@RepositoryRestResource?,spring-boot,spring-data-jpa,spring-rest,Spring Boot,Spring Data Jpa,Spring Rest,我已经创建了一个@RepositoryRestResource @RepositoryRestResource(collectionResourceRel=“tracks”,path=“tracks”) 公共接口TrackRepository扩展了分页和排序存储库{ } 除了一些其他的@RestController: @RestController @请求映射(“/api”) 公共类用户控制器{ 私人用户服务; @自动连线 公共用户控制器(用户服务用户服务){ this.userService

我已经创建了一个
@RepositoryRestResource

@RepositoryRestResource(collectionResourceRel=“tracks”,path=“tracks”)
公共接口TrackRepository扩展了分页和排序存储库{
}
除了一些其他的
@RestController

@RestController
@请求映射(“/api”)
公共类用户控制器{
私人用户服务;
@自动连线
公共用户控制器(用户服务用户服务){
this.userService=userService;
}
@RequestMapping(value=“/users”,method=RequestMethod.POST)
公共@ResponseBody
用户姿势(@Validated@RequestBody凭据){
返回此.userService.postaser(凭据);//注册用户
}
}
在我的应用程序.属性中我正在设置

spring.data.rest.base-path=/api
而这是
@springbootplication
的入口点:

@springboot应用程序
@EnableJpaRepositories(basePackages={“io.app.spring.repository”})
@EnableGlobalMethodSecurity(Prespenabled=true,proxyTargetClass=true)
@EntityScan(basePackages=“io.app.hibernate.model”)
@启用事务管理
公共类应用程序{
私有最终静态记录器Logger=LogManager.getLogger(Application.class);
@施工后
void开始(){
TimeZone.setDefault(TimeZone.getTimeZone(“Etc/UTC”);
}
@自动连线
公共应用程序(环境){
LOGGER.info(“”);
LOGGER.info(“活动配置文件:”);
对于(字符串配置文件:environment.getActiveProfiles()){
LOGGER.info(“+profile”);
}
LOGGER.info(“”);
}
公共静态void main(字符串[]args){
调试(“正在运行的应用程序…”);
SpringApplication.run(Application.class,args);
}
}
但是,我没有看到下面的
TrackRepository
的端点。仅限来自
UserController
的用户:

。。
“/api/users”:{
“职务”:{
“操作ID”:“姿势者”,
“请求主体”:{
“内容”:{
"*/*": {
“模式”:{
“$ref”:“#/components/schema/Credentials”
}
}
}
},
“答复”:{
"200": {
“说明”:“默认响应”,
“内容”:{
"*/*": {
“模式”:{
“$ref”:“#/components/schemas/User”
}
}
}
}
}
}
}
..
我使用的是Spring Boot
2.2.2.RELEASE

这是我正在使用的整个pom.xml


4.0.0
音频平台


伊奥·斯普林福克斯
springfox-Swagger 2
3.0.0-SNAPSHOT
伊奥·斯普林福克斯
springfox招摇过市用户界面
3.0.0-SNAPSHOT
伊奥·斯普林福克斯
springfox数据rest
3.0.0-SNAPSHOT
但它仍然不起作用


你知道这是什么原因吗?

请尝试像这样将
@Import(SpringDataRestConfiguration.class)
添加到你的应用程序配置中

compile('io.springfox:springfox-swagger2:2.7.0')
compile('io.springfox:springfox-data-rest:2.7.0')
compile('io.springfox:springfox-swagger-ui:2.7.0')
@springboot应用程序
@EnableJpaRepositories(basePackages={“io.app.spring.repository”})
@EnableGlobalMethodSecurity(Prespenabled=true,proxyTargetClass=true)
@EntityScan(basePackages=“io.app.hibernate.model”)
@启用事务管理

@Import(SpringDataRestConfiguration.class)//我的Spring版本中似乎不存在此类。或者我必须包含另一个依赖项吗?我在答案中添加了更多的上下文。希望这有助于在Spring Boot 1.5.4上运行。我使用的是SpringBoot 2.2.2springfox-data-rest版本现在是3.0.0,我也遇到了同样的问题,v2/api文档可以正常工作,没有显示swagger/index html