Spring Data REST(SDR)是一个Spring Data项目,旨在使Spring Data存储库作为REST服务公开。 SDR在内部使用Spring HATEOAS来创建HAL响应。
Spring Boot 3.4.1:为什么 spring.data.rest.base-path 导致 404 错误?可能与 DevTools 发生冲突?
我最近将 Spring Boot 应用程序从版本 3.4.0 升级到 3.4.1,并遇到了 Spring Data REST 的问题。 在版本 3.4.0(以及所有以前的 3.x 版本)中,以下配置...
如何在 Spring Boot 3.4.0 中配置 PersistentEntityJackson2Module?
我们正在将 Spring Boot 应用程序(Spring Data Rest 与普通 mvc 的混合)从版本 2.5.12 迁移到 3.4.0。该应用程序很大程度上依赖于配置了 h...
如何在 Spring Data Rest 中保护 RepositoryRestResource
我有一个 Spring 数据存储库,我使用 @RepositoryRestResource 注释为其生成 REST 资源。现在我想使用 spring security 来控制对其的访问。 我知道有可能...
RepositoryRestController:使用多个 HAL URI 进行 POST
我在用户和地址之间有一对多关系,以及与就业类型的多对一关系。 @实体 公共类用户{ //.. 私有字符串名称; @ManyToOne 私人就业类型
如何轻松地以 Spring Data REST 等格式公开端点?
我在我们的项目中使用 SDR,它会生成数百个端点,但每当我手动创建端点时,我都很难将所有这些链接建立到所有实体,有没有一种简单的方法可以做到这一点? 我的
我有以下实体(省略无关部分): @实体 公开课图{ @ManyToOne private Parameter 参数; } @实体 @DiscriminatorColumn(name="类别&...
storerestresource 注释不会创建 REST 端点
我正在尝试使用 paulcwarren 的 Spring Content REST 库,我遇到的问题是,当我创建存储接口时,它不会创建其余 api 端点,因为当我尝试...
我在更新现有实体的单向外键字段时遇到问题。客户端发送包含完整实体数据(包括父实体和子实体)的 PUT 请求,但仅包含
如何在 spring-data-rest 中禁用 JpaRepository 的分页
我使用 spring-data-rest 和 JpaRepository 来创建 Rest-Endpoints。默认情况下,所有 JpaRepository 都启用分页,这是一件好事。但我有一个遗留应用程序,我们将其移植到...
在 Spring Data Rest 中,如何防止 DELETE HTTP 方法从我的 JpaRepository 导出?
我正在使用 spring-data-rest 并且我有一个像这样的 JpaRepository : @RepositoryRestResource(路径=“项目”) 公共接口 ProjectsRepository 扩展了 JpaRepository 我正在使用 spring-data-rest 并且我有一个像这样的 JpaRepository: @RepositoryRestResource(path = "projects") public interface ProjectsRepository extends JpaRepository<MetricsProjects, Integer> {...} 我的存储库界面: @RepositoryRestResource(path = "projects") public interface ProjectsRepository extends JpaRepository<MetricsProjects, Integer> { List<MetricsProjects> findByProjectName(String projectName); @Override @RestResource(exported = false) public void deleteById(Integer id); @Override @RestResource(exported = false) public void delete(MetricsProjects entity); @Override @RestResource(exported = false) public void deleteAll(Iterable<? extends MetricsProjects> entities); @Override @RestResource(exported = false) public void deleteAll(); @Override @RestResource(exported = false) public void deleteInBatch(Iterable<MetricsProjects> entities); @Override @RestResource(exported = false) public void deleteAllInBatch(); } 我还添加了disableDefaultExposure(),正如某处建议的那样。 我的配置文件: @Configuration public class SpringDataRestConfiguration implements RepositoryRestConfigurer { @Override public void configureRepositoryRestConfiguration(RepositoryRestConfiguration restConfig) { restConfig.disableDefaultExposure(); } } 但是我仍然看到从 Swagger-UI 中公开的 DELETE 方法,我该如何防止这种情况? 为 DELETE 端点创建一个控制器方法并返回 405 Method Not Allowed。 为了禁用 Swagger(Springfox 库)中特定端点的显示,我在存储库类中的关联方法上添加了注释 ApiIgnore : @Override @ApiIgnore @RestResource(exported = false) public void deleteById(Integer id); 将configureRepositoryRestConfiguration修改为 @Override public void configureRepositoryRestConfiguration(RepositoryRestConfiguration restConfig) { restConfig.getExposureConfiguration() .forDomainType(put the class type here) .withItemExposure((metadata, httpMethods) -> httpMethods.disable(HttpMethod.DELETE)) .withCollectionExposure((metadata, httpMethods) -> httpMethods.disable(HttpMethod.DELETE)); } 将此处的类类型替换为 className.class,例如,如果 className 是 MetricsProjects,则将 MetricsProjects.class 放在那里。 这是附加信息。
我无法分享当前应用程序中的特定代码片段,但结构主要由实体和存储库类组成。 我们遇到了 PATCH 方法的问题。预期的
我是 Spring Boot 的新手,现在经过一些课程后,我正在尝试创建 RESTful+Hibernat+MySQL 应用程序。我创建了: 实体 @实体 @Table(名称=“客户”) @NamedQueries({ @NamedQuery(n...
如何使用@FeignClient映射HAL JSON_embedded集合
我们尝试使用 spring-cloud @FeignClient 从另一个微服务调用一个微服务的 HAL-JSON REST API。该服务是使用 Spring Data Rest、Spring Boot 1.4 实现的,具有 Ha...
如何调用Spring Data Rest上定义的findAllById?
我想使用spring-data自带的findAllById方法,并且它应该被spring-data-rest公开。但是我无法发出正确的请求来调用此方法,没有......
Spring Data REST 自定义资源 URI 适用于 String,但不适用于 Long
我有一个模型: 公共类我的模型{ @Id私有长id; 私有长外部ID; // 获取器、设置器 } 我想使用 externalId 作为我的资源标识符: @配置 静态...
我们在连接到 postgres 数据库的 PagingAndSortingRepository 之上使用非常简单的 @RepositoryRestResource 设置。我们还配置了 spring.jackson.property-naming-strategy=
覆盖 Spring Data Rest 生成的 api 中的响应代码
我们使用 Spring Data Rest 注释存储库,@RepositoryRestResource 默认提供 CRUD API。在我们目前使用的spring boot 2.7.3中,删除API返回 204 无内容 布...
我正在将 Spring 数据与 REST 结合使用。我有一个表国家和一个与其对应的名为 Country.java 的实体 我在 CountryRepositopry 中将我的方法注释为 公共接口 CountryRepository
Spring Boot LocalDate 字段序列化与反序列化
在 Spring Boot 1.2.3.RELEASE 中使用 fastxml 将 LocalDate 字段序列化和反序列化为 ISO 日期格式字符串的正确方法是什么? 我试过了: spring.jackson.serialization.write...