0
내 응용 프로그램에 ID가 인 엔티티가 있습니다. 내 컨트롤러에서
나는 사용하여이 법인이 방법으로 @PathVariable
수 :Spring @PathVariable 사용자 지정 개체 만들기
@RequestMapping("/{year}/{code}")
public MyCustomObj get(@PathVariable Integer year, @PathVariable Integer code){
return myCustomObjRepository.findOne(new CustomId(year, code));
}
인가 그것을 가능, 내 방법은 이런 식으로 작동하는지, WebArgumentResolver
같은 일부 구성 요소를 사용하여 :
@RequestMapping("/{customObj}")
public MyCustomObj get(@PathVariable CustomId id){
return myCustomObjRepository.findOne(id);
}
필요 a URL은 다음과 같습니다. /application/2013/06
필터가있는 http 리디렉션이 마음에 드십니까? – shazinltc
가능한 [Bind Path 변수를 봄에 사용자 정의 모델 객체에 바인딩] (http://stackoverflow.com/questions/17149425/bind-path-variables-to-a-custom-model-object-in-spring) – vincentks
Ops ... 나는 그것을 보지 못했습니다 ... 그래서 질문을 닫을 수 있습니다 ... 감사합니다. – rascio