강의

멘토링

커뮤니티

Inflearn Community Q&A

heartrose1696's profile image
heartrose1696

asked

[Revised 2023-11-27] Developing RESTful Web Services using Spring Boot 3.x

How to Implement Internationalization

질문이 있습니다.~

Written on

·

238

0

안녕하세요. 샘

혹시 국가별 언어 셋팅도, RestControllerAdvice를 이용하여, Aop처럼 사용할 수 있을까요??

이전 강의에서 Exception은 @ExceptionHandler로 특정 클래스예외에서 캐치할 수 있는거같은데.. 이건 그렇게 활용할 수 있는 방법이 없을까요??

spring-bootrest-api

Answer 2

0

heartrose1696님의 프로필 이미지
heartrose1696
Questioner

감사합니다~~!

0

Dowon Lee님의 프로필 이미지
Dowon Lee
Instructor

안녕하세요, 이도원입니다. 

말씀하신 RestControllerAdvice에서는 예외를 캐치하는 방법에서 주로사용되고 있습니다. 국가별 언어 설정을 위해서는 LocaleResolver 클래스를 이용해 보시면 좋을 듯 합니다. WebMvcConfigurerAdapter 라는 클래스를 상속받는 Configuration 클래스에서  addInterceptors 메소드를 재정의해서 사용하실 수 있을거 같습니다. 

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/LocaleResolver.html

감사합니다.  

heartrose1696's profile image
heartrose1696

asked

Ask a question