스프링 부트 애플리케이션에서 POSTMAN을 사용하여 간단한 POST 작업을하고 싶습니다. 데이터 게시를 시도 할 때 예외가 발생합니다. spring-boot-starter-data-rest
덕분에 작업 엔터티, 컨트롤러 및 서비스 레이어가 없습니다. 올리려고하면 org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: No content to map due to end-of-input; nested exception is com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
예외가 발생합니다.POST 액션에서의 예외, 입력 끝으로 인해 맵핑 할 내용이 없음
@Entity
public class Job {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String code;
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
그리고 마지막으로 내 저장소 :
@Repository
public interface JobRepository extends
PagingAndSortingRepository<Job,Long> {
Job findJobByName(@Param("name")String name);
}
내 POST 요청은 다음과 같습니다
내 작업 모델입니다 로컬 호스트 : 8080/작업/코드 = 코드 & 이름 = 이름콘텐츠 유형 : application/schema + json
나는 H2와 협력하고 있습니다. 도움 주셔서 감사합니다.
또한 컨트롤러 코드를 공유하십시오. – MohamedSanaulla
앞서 언급했듯이 spring-boot-starter-data-rest 의존성 때문에 컨트롤러가 없습니다. –