snake_case 형식의 나머지 컨트롤러에 정렬 매개 변수를 전달하는 방법을 알려 주시겠습니까?
내 엔티티 클래스
@Entity
public class MyEntity extends BaseEntity{
@Id
private Long id;
@Column
private Long parentId;
}
컨트롤러 방식
@GetMapping("list")
List<MyEntity> getEntityList(
@PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable);
}
요청에 사용하고 싶습니다 ?sort=parent_id
Jackson2ObjectMapperBuilder를 만들었고 올바른 snake_case json을 빌드합니다.
그러나 봄은 봄 Caused by: org.springframework.data.mapping.PropertyReferenceException: No property parent found for type MyEntity! Did you mean 'parentId'?
이 '_'기호 뒤에 모든 것을 잘라 내기 때문에 이것이 파싱에 관한 문제라고 생각합니다.
난 노력 했어:
- @JsonNaming (PropertyNamingStrategy.SnakeCaseStrategy.class)
- @Column (name = "parent_id") @JsonProperty ( "parent_id")
- @JsonNaming (PropertyNamingStrategy.SnakeCaseStrategy.class)