feat: セキュリティフィルターの前にMDCを追加するように

This commit is contained in:
usbharu 2023-10-24 20:19:22 +09:00
parent a98af0185c
commit 98d3234e18
1 changed files with 5 additions and 2 deletions

View File

@ -5,10 +5,13 @@ import jakarta.servlet.FilterChain
import jakarta.servlet.ServletRequest
import jakarta.servlet.ServletResponse
import org.slf4j.MDC
import org.springframework.stereotype.Service
import org.springframework.boot.autoconfigure.security.SecurityProperties
import org.springframework.core.annotation.Order
import org.springframework.stereotype.Component
import java.util.*
@Service
@Component
@Order(SecurityProperties.DEFAULT_FILTER_ORDER - 1)
class MdcXrequestIdFilter : Filter {
override fun doFilter(request: ServletRequest?, response: ServletResponse?, chain: FilterChain) {
val uuid = UUID.randomUUID()