-이때 국제화 또는 i18n을 사용해야 함
@RequestMapping(path = "/hello-world-Internatlized")
public String helloWorldInternatlized() {
return "Hello world V2";
//1: 메세지 저장
//2: 이 값을 가져올 수 있는 코드 작성
}
private MessageSource msgSource;
//메시지의 매개변수화나 국제화에 대한 지원을 통해 메시지를 처리
public HellowWorldController(MessageSource msgSource) {
this.msgSource = msgSource;
}
@RequestMapping(path = "/hello-world-Internatlized")
public String helloWorldInternatlized() {
Locale locale = LocaleContextHolder.getLocale();
//현재 스레드와 연관된 로케일을 반환
//사용자는 요청과 함께 Accept 헤더를 감지하는데, 그다음 해당 헤더에 대한 로케일은 LocaleContextHolder.getLocale();에 의해 반환.
return msgSource.getMessage("good.morning.message", null, "Default Msg", locale);
//return "Hello world V2";
//1: 메세지 저장
//2: 이 값을 가져올 수 있는 코드 작성
}
결과