- Interceptor에서 Accept-Language 헤더를 파싱 - 요청 단위 LangContext에 언어 정보 저장 - 서비스 및 예외 처리 계층에서 언어 컨텍스트 주입 - enum 및 when 기반 언어 정책을 한 곳으로 통합
30 lines
1.1 KiB
Kotlin
30 lines
1.1 KiB
Kotlin
package kr.co.vividnext.sodalive.configs
|
|
|
|
import kr.co.vividnext.sodalive.i18n.LangInterceptor
|
|
import org.springframework.context.annotation.Configuration
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
|
|
|
@Configuration
|
|
class WebConfig(
|
|
private val langInterceptor: LangInterceptor
|
|
) : WebMvcConfigurer {
|
|
override fun addInterceptors(registry: InterceptorRegistry) {
|
|
registry.addInterceptor(langInterceptor).addPathPatterns("/**")
|
|
}
|
|
|
|
override fun addCorsMappings(registry: CorsRegistry) {
|
|
registry.addMapping("/**")
|
|
.allowedOrigins(
|
|
"http://localhost:8888",
|
|
"https://creator.sodalive.net",
|
|
"https://test-creator.sodalive.net",
|
|
"https://test-admin.sodalive.net",
|
|
"https://admin.sodalive.net"
|
|
)
|
|
.allowedMethods("*")
|
|
.allowCredentials(true)
|
|
}
|
|
}
|