Spring MVC
-
HTTP 요청 맵핑하기 4부: 헤더와 매개변수SPRING/스프링 MVC 2021. 6. 26. 23:54
특정한 헤더가 있는 요청을 처리하고 싶은 경우 @RequestMapping(headers = “key”) 특정한 헤더가 없는 요청을 처리하고 싶은 경우 @RequestMapping(headers = “!key”) 특정한 헤더 키/값이 있는 요청을 처리하고 싶은 경우 @RequestMapping(headers = “key=value”) 특정한 요청 매개변수 키를 가지고 있는 요청을 처리하고 싶은 경우 @RequestMapping(params = “a”) 특정한 요청 매개변수가 없는 요청을 처리하고 싶은 경우 @RequestMapping(params = “!a”) 특정한 요청 매개변수 키/값을 가지고 있는 요청을 처리하고 싶은 경우 @RequestMapping(params = “a=b”) @Controlle..
-
Formatter 추가하기SPRING/스프링 MVC 2021. 6. 14. 22:43
Formatter : Formatter는 데이터 바인딩을 수행해주는 것을 도와줍니다. 즉, 객체 문자열 간의 변환을 수행합니다. 예제 코드 public class Person { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } // @Component // 등록 방식 1 : Component로 등록시 WebConfig에서 addFormatter로 Formatter를 추가하지 않아도 된다. public class PersonFormatter implements Formatter { @Override public Person parse(Strin..