diff --git a/src/main/java/com/kwan/springbootkwan/filter/TimeFilter.java b/src/main/java/com/kwan/springbootkwan/filter/TimeFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..fd8064ed4fc9ab8bc8f5b45487ba79f8ac1103be --- /dev/null +++ b/src/main/java/com/kwan/springbootkwan/filter/TimeFilter.java @@ -0,0 +1,25 @@ +package com.kwan.springbootkwan.filter; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import java.io.IOException; + +@Slf4j +@Component +@Order(1) +public class TimeFilter implements Filter { + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + log.info("先执行:接口执行时间"); + chain.doFilter(request, response); + } +} +