✅ Filter
인터페이스
Filter
인터페이스를 상속받는다doFilter
메소드를 필수로 구현한다package com.joo.usedmarket1;
import java.io.IOException;
import org.springframework.stereotype.Component;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebFilter;
import lombok.extern.slf4j.Slf4j;
@Component
@WebFilter("/*") // 루트 주소로 오면 해당 필터 적용
@Slf4j
public class TestFilter implements Filter{
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
log.debug("필터가 적용되었다! ========== ");
chain.doFilter(request, response);
}
}