ICode9

精准搜索请尝试: 精确搜索
  • java-使用Spring-Data-Rest以XML而不是JSON的形式返回响应2019-12-01 03:10:56

    当前的RC1是Spring-data-rest(即将于7月16日在GA发布),但是文档仍然有些粗略.到目前为止,我发现的所有示例代码均显示默认为JSON的响应,但我需要XML,理想情况下,还需要基于ACCEPT标头的XML或JSON.我在some comments in a DZone link中找到了一个表明将要支持XML的来源.但这是在RC1

  • java-覆盖Pageable findAll以在Spring Data Rest中选择较少的列2019-11-21 05:04:45

    当转到从Spring数据库中的/ api页面发现的页面时,如何覆盖spring数据存储库以仅选择选定的列. 我添加了findAll如下- public interface UserRepository extends BaseRepository<User, Integer>, UserRepositoryCustom { @Query("select u from User u where email = :email a

  • 将Spring Data Rest存储库注入实用程序类2019-11-20 23:19:47

    经过一天的搜索,尝试了所有配置(应用程序上下文)和注释(自动装配,注入,组件等)后,我似乎无法获得pojo类来成功注入工作库-该值始终为null. 我开始怀疑是否将除控制器之外的任何内容注入到Spring数据仓库的架构中都是相反的. 这是我的应用程序上下文(摘自spring docs): <?xml versio

  • java-Spring Data Rest:如何通过另一个对象的键进行搜索?2019-11-20 21:02:20

    在Spring-Data-Rest中,对象的ID是随对象返回的URI.例如,如果我有一个用户,则它可能具有类似以下内容的URI: http://example.com/users/1 在真实的REST api中,此URI是对象的ID,您不应仅使用“ 1”作为ID. 给出该答案,我该如何搜索属于该用户的所有订单? http://example.com/orders/

  • java-Spring JPA Projection包括链接2019-11-20 07:19:25

    给定一个简单的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=

  • java-强制spring数据其余部分使用https方案2019-11-18 02:11:40

    我在应用程序中使用了spring-data-rest,该应用程序是apache反向代理的背后,该代理从HTTP重定向到HTTPS 反过来,这会导致错误的hrefs:http而不是https方案. 例: { "_links" : { "profile" : { "href" : "http://my.host/api/profile" } } } 有什么方法可以配置spr

  • 如何在Spring Data REST中使用spring.data.rest.enable-enum-translation2019-11-11 07:19:56

    我正在使用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

  • java-如何在spring-boot数据其余部分的POST json中传递@EmbeddedId2019-11-08 08:04:36

    我已经使用Spring Boot Data REST构建了一个REST API.我正在使用EmbeddedId,并且还实现了BackendIdConverter. 以下是我的嵌入式课程 @Embeddable public class EmployeeIdentity implements Serializable { @NotNull @Size(max = 20) private String employeeId;

  • java-使用spring-data-rest定义路径为“ / {resourcename} / search /”的自定义方法2019-10-29 16:29:03

    我很困惑.我不知道如何将自定义“搜索”方法与通过spring-data-rest加载的方法一起定义. 您能回答我吗,框架是否有这种可能性?如果有的话,您能告诉我,我在哪里可以找到它? 为了更深入地了解我的情况,我描述了我的问题: class UserService { public String getListOfWaitingUsers(

  • java-Spring Data Rest存储库不会公开删除2019-10-27 04:01:34

    我有一个User对象的存储库,并且我试图通过从CRUD存储库复制签名来公开删除: public interface UserRepository extends Repository<User, String>{ @RestResource(exported = false) User findOne(String username); @PreAuthorize("hasRole('ROLE_USERS_READ')")

  • 春季-不要使用RepositoryRestResource插入重复项2019-10-26 11:20:32

    我有我的存储库类,它公开了REST接口 @RepositoryRestResource(collectionResourceRel = "user", path = "user") public interface UserRepository extends CrudRepository<User, Integer> { } 我想避免通过POST请求插入重复的对象. 我用约束保护了我的数据库,现在在数据库方面

  • 春季-触发“ beforeSave” RepositoryEventHandler之前的实体验证2019-10-26 07:18:55

    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

  • 春季启动升级后,控制台中的@ExceptionHandler空指针2019-10-26 03:19:46

    今天,我感到有点幸运,所以我从Spring boot 1.5.1升级到了最新版本.当我运行我的JAR文件时,起初一切似乎都很好. 但是,当我进行预期返回错误响应的调用(负测试-说“未找到记录”)时,它将返回预期格式正确的JSON响应. 但是,我也注意到控制台中有一个巨大的堆栈跟踪. 有一个WARN级别的

  • java-Spring数据其余部分通过一个Crud存储库管理所有实体2019-10-13 18:11:42

    我需要知道是否有可能在Spring数据其余部分中使用一个Crud存储库来管理多个实体. 范例: 图书馆实体 @Entity public class Library { @Id @GeneratedValue private long id; @Column private String name; @OneToMany(mappedBy = "library") privat

  • Spring Data REST无法将数据发布到REST API2019-10-13 13:19:54

    当我尝试使用以下命令将数据发布到我的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

  • java-Spring Data Rest中的分页用于嵌套资源2019-10-13 07:01:52

    当访问下面的URL时,我得到分页 /api/userPosts/ { "_links" : { "self" : { "href" : "/api/userPosts{?page,size,sort}", "templated" : true }, "next" : { "href" : api/us

  • 具有关联关系的实体的Spring数据休息状态5002019-10-12 07:20:00

    我有两个实体,一对多 public class Order { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String userName; private String company; @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}) @JoinColu

  • java-调用spring数据其余存储库方法不会返回链接2019-10-11 20:28:54

    我有存储库“ ClientRepository”: public interface ClientRepository extends PagingAndSortingRepository<Client, Long> { } 当我请求http://localhost:8080/clients/1时,服务器响应 { "algorithmId" : 1, "lastNameTxt" : "***", "firs

  • java-未正确启用Spring Boot Data Rest CORS的OPTIONS / DELETE2019-10-11 14:29:15

    我有一个非常简单的例子,我无法上班. 我有为数据库和存储库建模的域. public interface MyTestRepository extends CrudRepository<MyTest, Integer> { } 我用http://resttesttest.com/进行了测试.对于GET方法,它返回我的JSON REST信息没有任何问题. 我可以查询端点http://localh

  • 如何将列表发布到Spring Data Rest?2019-10-06 13:21:35

    我跟着this example,它允许发布一个唯一的Person对象.我想要一个REST服务,我可以一次发布一个Person集合,例如列表/任何名为Team的集合,只需一次调用即可拥有多个Person对象. 我的意思是,我的问题并不完全是关于OneToMany关系,你在REST请求中发送每个人.本主题是well answered. 我

  • java – Spring Data REST – 自v.2.5.7起,PUT请求无法正常工作2019-10-05 21:03:59

    从版本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),那么我

  • java – Spring Data REST如何在线添加嵌入式资源2019-10-04 17:10:39

    我正在将Spring Data REST和Hateoas与HAL浏览器结合使用.这很好用,但现在我想用一组特定的实体和一组相关的对象进行JSON转储.我使用@Projection然后再次卡住了. 仅供参考:正常行为(包含嵌入式和链接等)应保留在新端点之外(没有嵌入式和链接). 为了进一步说明我的问题/问题: class P

  • java – 如何在@HandleBeforeSave事件中获取旧实体值以确定属性是否已更改?2019-10-04 00:10:11

    我正试图在@HandleBeforeSave事件中获取旧实体. @Component @RepositoryEventHandler(Customer.class) public class CustomerEventHandler { private CustomerRepository customerRepository; @Autowired public CustomerEventHandler(CustomerRepository customer

  • android – 使用spring数据rest创建带有引用的资源2019-10-03 14:26:30

    我正在使用spring数据休息,我有通过spring数据休息暴露的以下实体 DonationRequest @Data @Entity @Table(name="donation_request",schema="public") public class DonationRequest { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="

  • java – Spring REST LocalDate UTC有一天不同2019-10-03 02:19:08

    我正在使用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

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有