Spring Data Rest 存储库偶尔无法导出
Spring Data Rest repositories occasionally not exported
我在使用 Spring 数据恢复 (3.2.6.RELEASE
) 的 Spring 启动应用程序 (2.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"
}
}
}
当它不工作时 returns:
{
"_links": {
"profile": {
"href": "http://localhost:8080/api/profile"
}
}
}
一些额外的发现:
- JPA 组件扫描在两种情况下都有效
- 存储库本身在这两种情况下都可以正常工作,使用这些存储库的自定义控制器工作正常
- 为
org.springframework.data
启用调试日志记录会在两种情况下产生完全相同的输出
- 比较执行器端点的响应未显示任何明显差异
- 存储库检测策略明确设置为
RepositoryDetectionStrategies.ANNOTATED
- 我无法在 SSCE 中重现它
- 模块已从 Spring Boot 1.5.18 升级,升级后问题开始出现。
其他人以前遇到过这个问题吗?这可能是什么原因造成的?或者关于如何进一步分析这个问题的一些指示?
听起来您 运行 喜欢 DATAREST-1502,它已在 3.2.7 和更新版本中修复。
我在使用 Spring 数据恢复 (3.2.6.RELEASE
) 的 Spring 启动应用程序 (2.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"
}
}
}
当它不工作时 returns:
{
"_links": {
"profile": {
"href": "http://localhost:8080/api/profile"
}
}
}
一些额外的发现:
- JPA 组件扫描在两种情况下都有效
- 存储库本身在这两种情况下都可以正常工作,使用这些存储库的自定义控制器工作正常
- 为
org.springframework.data
启用调试日志记录会在两种情况下产生完全相同的输出 - 比较执行器端点的响应未显示任何明显差异
- 存储库检测策略明确设置为
RepositoryDetectionStrategies.ANNOTATED
- 我无法在 SSCE 中重现它
- 模块已从 Spring Boot 1.5.18 升级,升级后问题开始出现。
其他人以前遇到过这个问题吗?这可能是什么原因造成的?或者关于如何进一步分析这个问题的一些指示?
听起来您 运行 喜欢 DATAREST-1502,它已在 3.2.7 和更新版本中修复。