当前的RC1是Spring-data-rest(即将于7月16日在GA发布),但是文档仍然有些粗略.到目前为止,我发现的所有示例代码均显示默认为JSON的响应,但我需要XML,理想情况下,还需要基于ACCEPT标头的XML或JSON.我在some comments in a DZone link中找到了一个表明将要支持XML的来源.但这是在RC1
当转到从Spring数据库中的/ api页面发现的页面时,如何覆盖spring数据存储库以仅选择选定的列. 我添加了findAll如下- public interface UserRepository extends BaseRepository<User, Integer>, UserRepositoryCustom { @Query("select u from User u where email = :email a
经过一天的搜索,尝试了所有配置(应用程序上下文)和注释(自动装配,注入,组件等)后,我似乎无法获得pojo类来成功注入工作库-该值始终为null. 我开始怀疑是否将除控制器之外的任何内容注入到Spring数据仓库的架构中都是相反的. 这是我的应用程序上下文(摘自spring docs): <?xml versio
在Spring-Data-Rest中,对象的ID是随对象返回的URI.例如,如果我有一个用户,则它可能具有类似以下内容的URI: http://example.com/users/1 在真实的REST api中,此URI是对象的ID,您不应仅使用“ 1”作为ID. 给出该答案,我该如何搜索属于该用户的所有订单? http://example.com/orders/
给定一个简单的Event模型,该模型具有一组Booking对象: 事件: @Entity public class Event { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long eventId; private Date start; private Date end; private String title; @OneToMany(mappedBy=
我在应用程序中使用了spring-data-rest,该应用程序是apache反向代理的背后,该代理从HTTP重定向到HTTPS 反过来,这会导致错误的hrefs:http而不是https方案. 例: { "_links" : { "profile" : { "href" : "http://my.host/api/profile" } } } 有什么方法可以配置spr
我正在使用Spring Boot 1.5.3,Spring Data REST,HATEOAS,Hibernate. 在我的模型中,有时会使用如下枚举: public enum Roles { ROLE_ADMIN, ROLE_USER, ROLE_MANAGER, ROLE_TECH } 根据Spring Boot documentation的介绍,有一个有用的属性: # DATA REST (RepositoryRestProp
我已经使用Spring Boot Data REST构建了一个REST API.我正在使用EmbeddedId,并且还实现了BackendIdConverter. 以下是我的嵌入式课程 @Embeddable public class EmployeeIdentity implements Serializable { @NotNull @Size(max = 20) private String employeeId;
我很困惑.我不知道如何将自定义“搜索”方法与通过spring-data-rest加载的方法一起定义. 您能回答我吗,框架是否有这种可能性?如果有的话,您能告诉我,我在哪里可以找到它? 为了更深入地了解我的情况,我描述了我的问题: class UserService { public String getListOfWaitingUsers(
我有一个User对象的存储库,并且我试图通过从CRUD存储库复制签名来公开删除: public interface UserRepository extends Repository<User, String>{ @RestResource(exported = false) User findOne(String username); @PreAuthorize("hasRole('ROLE_USERS_READ')")
我有我的存储库类,它公开了REST接口 @RepositoryRestResource(collectionResourceRel = "user", path = "user") public interface UserRepository extends CrudRepository<User, Integer> { } 我想避免通过POST请求插入重复的对象. 我用约束保护了我的数据库,现在在数据库方面
Spring Data REST docs描述了在RepositoryEventHandler触发后验证实体的方法: you simply need to register an instance of your validator with the bean whose job it is to invoke validators after the correct event 在将实体传递给“ beforeSave” RepositoryEventHand
今天,我感到有点幸运,所以我从Spring boot 1.5.1升级到了最新版本.当我运行我的JAR文件时,起初一切似乎都很好. 但是,当我进行预期返回错误响应的调用(负测试-说“未找到记录”)时,它将返回预期格式正确的JSON响应. 但是,我也注意到控制台中有一个巨大的堆栈跟踪. 有一个WARN级别的
我需要知道是否有可能在Spring数据其余部分中使用一个Crud存储库来管理多个实体. 范例: 图书馆实体 @Entity public class Library { @Id @GeneratedValue private long id; @Column private String name; @OneToMany(mappedBy = "library") privat
当我尝试使用以下命令将数据发布到我的REST API(使用Spring DATA JPA REST创建)时: curl -g -i -X POST -H "Content-Type:application/json" -d '{ "profilphotoid" : 1 }' http://localhost:8080/users/ 我收到此错误: 2016-04-26 04:51:44.288 ERROR 10808 --- [nio
当访问下面的URL时,我得到分页 /api/userPosts/ { "_links" : { "self" : { "href" : "/api/userPosts{?page,size,sort}", "templated" : true }, "next" : { "href" : api/us
我有两个实体,一对多 public class Order { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String userName; private String company; @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}) @JoinColu
我有存储库“ ClientRepository”: public interface ClientRepository extends PagingAndSortingRepository<Client, Long> { } 当我请求http://localhost:8080/clients/1时,服务器响应 { "algorithmId" : 1, "lastNameTxt" : "***", "firs
我有一个非常简单的例子,我无法上班. 我有为数据库和存储库建模的域. public interface MyTestRepository extends CrudRepository<MyTest, Integer> { } 我用http://resttesttest.com/进行了测试.对于GET方法,它返回我的JSON REST信息没有任何问题. 我可以查询端点http://localh
我跟着this example,它允许发布一个唯一的Person对象.我想要一个REST服务,我可以一次发布一个Person集合,例如列表/任何名为Team的集合,只需一次调用即可拥有多个Person对象. 我的意思是,我的问题并不完全是关于OneToMany关系,你在REST请求中发送每个人.本主题是well answered. 我
从版本2.5.7开始,Spring Data REST没有正确执行PUT请求来更新具有相关资源的资源.与按预期工作的PATCH请求不同! 例如,Person与Addres有多对一关联.如果我们使用SDR v.2.5.6(Spring Boot v.1.4.3)执行PUT请求,那么一切正常.但是如果我们切换到2.5.7版(即Spring Boot v.1.4.4),那么我
我正在将Spring Data REST和Hateoas与HAL浏览器结合使用.这很好用,但现在我想用一组特定的实体和一组相关的对象进行JSON转储.我使用@Projection然后再次卡住了. 仅供参考:正常行为(包含嵌入式和链接等)应保留在新端点之外(没有嵌入式和链接). 为了进一步说明我的问题/问题: class P
我正试图在@HandleBeforeSave事件中获取旧实体. @Component @RepositoryEventHandler(Customer.class) public class CustomerEventHandler { private CustomerRepository customerRepository; @Autowired public CustomerEventHandler(CustomerRepository customer
我正在使用spring数据休息,我有通过spring数据休息暴露的以下实体 DonationRequest @Data @Entity @Table(name="donation_request",schema="public") public class DonationRequest { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="
我正在使用Spring Boot 1.5.4,Hibernate 5.2.10,Spring Data REST,HATEOAS,JDK8以及LocalDate和LocalDateTime. 我的计算机在CEST时区,但我希望应用程序在UTC中工作,所以我在application.properties中设置: spring.datasource.url=jdbc:mysql://localhost:3306/database?useLegacyD