Spring Data Rest储存库偶尔不导出

问题描述 投票:1回答:1

我在使用Spring Data Rest(2.2.6.RELEASE)的Spring Boot应用程序(3.2.6.RELEASE)中遇到一个奇怪的问题。有时我的存储库不会因休息而暴露。这是在使用完全相同的配置的应用程序具有完全相同的版本(相同的jar)中发生的。

有4个@RepositoryRestResource,并且在工作时,根资源公开此内容:

{
    "_links": {
        "entity-a": {
            "href": "http://localhost:8080/api/entity-a{?projection}",
            "templated": true
        },
        "entity-b": {
            "href": "http://localhost:8080/api/entity-b"
        },
        "entity-c": {
            "href": "http://localhost:8080/api/entity-c{?page,size,sort,projection}",
            "templated": true
        },
        "entity-d": {
            "href": "http://localhost:8080/api/entity-d"
        },
        "profile": {
            "href": "http://localhost:8080/api/profile"
        }
    }
}

并且当它不工作时返回:

{
    "_links": {
        "profile": {
            "href": "http://localhost:8080/api/profile"
        }
    }
}

一些其他发现:

  • JPA组件扫描在两种情况下均有效
  • 存储库本身在两种情况下都是起作用的原因,使用这些存储库的自定义控制器可以正常工作
  • 在两种情况下为org.springframework.data启用调试日志记录会产生完全相同的输出
  • 比较执行器端点的响应没有显示任何明显的差异
  • 存储库检测策略显式设置为RepositoryDetectionStrategies.ANNOTATED
  • 我无法在SSCE中复制它
  • 模块已从Spring Boot 1.5.18升级,升级后问题开始出现。

其他人以前遇到过这个问题吗?是什么原因造成的?或关于如何进一步分析此问题的一些建议?

java spring spring-boot spring-data spring-data-rest
1个回答
0
投票

听起来像是您遇到了DATAREST-1502,在3.2.7及更高版本中已修复。

© www.soinside.com 2019 - 2024. All rights reserved.