我有两个简单的实体,例如:
public class Agent extends BasedEntity {
private String firstname;
private String lastname;
@ManyToOne
@JoinColumn(name="agency_id", nullable=true)
Agency agency;
}
和
public class Agency extends BasedEntity {
private String name;
private String address;
@OneToMany(mappedBy="agency")
private Set<Agent> agents;
}
@RepositoryRestResource
public interface AgencyRespository extends JpaRepository<Agency, Long> {
}
@RepositoryRestResource
public interface AgentsRespository extends JpaRepository<Agent, Long> {
}
当我使用]进行PUT时>
https://localhost:8080/api/v1/agents/64/agency body:https://localhost:8080/api/v1/agencies/50
它通过了,但是如果我对[POST]做过
https://localhost:8080/api/v1/agents/64/agency body:https://localhost:8080/api/v1/agencies/50
我得到一个
org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported
我有两个简单的实体,例如:公共类Agent扩展BasedEntity {private String firstname;私有字符串姓氏; @ManyToOne @JoinColumn(name =“ agency_id”,nullable = ...
您正在使用旧版本的Spring Data Rest。从2.3.x开始允许POST。