문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
springframework:springboot:mvc [2020/07/09 14:47] kwon37xi [설정 커스터마이즈] |
springframework:springboot:mvc [2020/07/17 10:21] (현재) kwon37xi [Converter] |
||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| - | ====== SpringBoot and Spring MVC ====== | + | ====== SpringBoot and Spring |
| ===== 설정 커스터마이즈 ===== | ===== 설정 커스터마이즈 ===== | ||
| * [[https:// | * [[https:// | ||
| 줄 8: | 줄 8: | ||
| * 이 경우 '' | * 이 경우 '' | ||
| * 즉, SpringBoot 에서는 '' | * 즉, SpringBoot 에서는 '' | ||
| + | |||
| + | ===== @WebMvcTest 가 잘되게 하려면 ===== | ||
| + | * [[springframework: | ||
| + | * 따라서 WebMvc 관련 설정(특히 '' | ||
| + | |||
| ===== Formatter ===== | ===== Formatter ===== | ||
| * Controller 파라미터로 들어온 **문자열을 객체로 변환**해주는 전역 설정. | * Controller 파라미터로 들어온 **문자열을 객체로 변환**해주는 전역 설정. | ||
| 줄 14: | 줄 19: | ||
| * [[https:// | * [[https:// | ||
| * Formatter와 Jackson Serializers/ | * Formatter와 Jackson Serializers/ | ||
| - | ===== Converter ===== | ||
| + | ==== Java 8 java.time.* Formatter 일괄 등록 ==== | ||
| + | * from https:// | ||
| + | * 아래 설정은 Java 8 '' | ||
| + | <code java> | ||
| + | @Configuration | ||
| + | public class MyApiWebMvcConfig | ||
| + | |||
| + | @Override | ||
| + | public void addFormatters(FormatterRegistry registry) { | ||
| + | DateTimeFormatterRegistrar dateTimeFormatterRegistrar = new DateTimeFormatterRegistrar(); | ||
| + | dateTimeFormatterRegistrar.setUseIsoFormat(true); | ||
| + | dateTimeFormatterRegistrar.registerFormatters(registry); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Converter ===== | ||
| + | * [[springframework: | ||