spring-data-rest

Why is DELETE not supported on to-many-association resources in Spring Data REST?

China☆狼群 提交于 2020-01-10 20:15:12
问题 I am using Spring Data REST. I am trying to unbind a collection association from an entity (item). i.e. - a property of the item is of List type. I want to remove all items from that List . To do this, I am using the DELETE method: curl -X DELETE …/categories/54ea0bcf27a2fb1b4641083a/fixedParentCategories This gives me a 405 Method not allowed error code. But, it works for a single valued association (when it is not of List type). The documentation clearly lists DELETE as a supported method

Why is DELETE not supported on to-many-association resources in Spring Data REST?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-10 20:15:06
问题 I am using Spring Data REST. I am trying to unbind a collection association from an entity (item). i.e. - a property of the item is of List type. I want to remove all items from that List . To do this, I am using the DELETE method: curl -X DELETE …/categories/54ea0bcf27a2fb1b4641083a/fixedParentCategories This gives me a 405 Method not allowed error code. But, it works for a single valued association (when it is not of List type). The documentation clearly lists DELETE as a supported method

Spring Data Rest (SDR ) bug? Persistent Entity Must not be null

心已入冬 提交于 2020-01-10 04:03:46
问题 Currently I am working on a POC for Spring Data Rest. Trying to get workable JSONout of a repository. I have an Entity Class (NewTask) @Entity @Table(name="newtable") public class NewTask { @Id @Column(name="newid") private int id; @Column(name="newage") private int age; @Column(name="newaddress") private String address; public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public int getId() { return id; } public void setId(int id)

HATEOAS paths are invalid when using an API Gateway in a Spring Boot app

微笑、不失礼 提交于 2020-01-09 20:33:42
问题 I have two spring boot applications where one of them is acting as an API Gateway (as discussed here Spring Example). The other which is wired into the first one is exposing a profile service using spring-data-rest (spring-data-neo4j-rest). The first application is starting on port 8080 and is using zuul to route requests to the second as follows: zuul: routes: profiles: path: /profiles/** url: http://localhost:8083/profiles/ This all works fine and requests to http://localhost:8080/profiles

Spring Data Rest 2.0.0.RELEASE Breaks Code Working Previously With RC1

邮差的信 提交于 2020-01-09 11:23:25
问题 I have a project which is utllizing Spring Data Rest. I originally had version 2.0.0.BUILD-SNAPSHOT in my pom.xml, but during my last update the code broke and began throwing the following IllegalStateException when accessing most endpoints: java.lang.IllegalStateException: No suitable resolver for argument [0] [type=org.springframework.http.converter.HttpMessageNotReadableException] HandlerMethod details: Controller [org.springframework.data.rest.webmvc.RepositoryEntityController] Method

How do you save files for entity in Spring Data Rest?

為{幸葍}努か 提交于 2020-01-06 08:05:42
问题 In a regular entity for SDR, it takes care of all properties of an entity for you saving it to the database. But how do you handle files? @Entity public class User { String name; Set<File> myfiles; //how can I make this work? } @RepositoryRestResource public interface UserRepository extends JpaRepository<User, Long> {} How can I make it so that a User owns a list of files, can upload and download them? 回答1: I suggest you can use @Lob instead to save file data (fileData variable below) @Entity

Spring Boot Data Rest don't support reactive?

假如想象 提交于 2020-01-06 08:04:08
问题 So, that error got in log ERROR 15340 --- [nio-8086-exec-9] o.s.d.r.w.RepositoryRestExceptionHandler : reactor.core.publisher.FluxOnAssembly cannot be cast to java.lang.Iterable Create a project by spring initialize: Reactive web, data-rest, data-rest-hal-browser, reactive-mongodb. When i try using data-rest router's i got error. In my opinion that happen, cuz data-rest don't support reactive. Can someone told how fix that? 回答1: No yet, see the ticket [DATAREST-933] 来源: https://stackoverflow

Spring Boot Data Rest don't support reactive?

瘦欲@ 提交于 2020-01-06 08:03:52
问题 So, that error got in log ERROR 15340 --- [nio-8086-exec-9] o.s.d.r.w.RepositoryRestExceptionHandler : reactor.core.publisher.FluxOnAssembly cannot be cast to java.lang.Iterable Create a project by spring initialize: Reactive web, data-rest, data-rest-hal-browser, reactive-mongodb. When i try using data-rest router's i got error. In my opinion that happen, cuz data-rest don't support reactive. Can someone told how fix that? 回答1: No yet, see the ticket [DATAREST-933] 来源: https://stackoverflow

Javers - DiffIgnore on bidirectional OneToMany

ⅰ亾dé卋堺 提交于 2020-01-06 07:24:51
问题 I am trying to integrate Javers with a Spring Data REST project. Currently I have the following entities in my domain. Student.class @Entity public class Person { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String firstName; private String lastName; private Long dob; @OneToOne private Gender gender; @OneToMany(cascade = CascadeType.ALL, mappedBy = "student", orphanRemoval = true) private List<ContactNumber> contactNumbers = new ArrayList<>(); }

How to unwrap Custom RuntimeException from Json Mapping Exception

偶尔善良 提交于 2020-01-06 05:16:08
问题 In a spring data rest project i use a custom RuntimeException to be called in a custom Deserializer public class LocalDateDeserializer extends StdDeserializer<LocalDate> { ... @Override public LocalDate deserialize(JsonParser jsonparser, DeserializationContext context) throws IOException, JsonProcessingException { String date = jsonparser.getText(); String name = jsonparser.getCurrentName(); try { return LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE); } catch (DateTimeParseException