package com.geekcattle.core.interceptor;

import com.geekcattle.util.IpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class ResourceInterceptor extends HandlerInterceptorAdapter {

    private static final String USER_AGENT = "user-agent";
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
            throws Exception {
        if(logger.isDebugEnabled()){
            String uri = request.getRequestURI();
            logger.info(uri);
            logger.info("UserAgent: {}", request.getHeader(USER_AGENT));
            logger.info("用户访问地址: {}, 来路地址: {}", uri, IpUtil.getIpAddr(request));
        }
        return true;
    }

}

package com.geekcattle.core.interceptor;

import com.geekcattle.util.IpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author geekcattle
 */
@Component
public class ResourceInterceptor extends HandlerInterceptorAdapter {

    private static final String USER_AGENT = "user-agent";
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
            throws Exception {
        if(logger.isDebugEnabled()){
            String uri = request.getRequestURI();
            logger.info(uri);
            logger.info("UserAgent: {}", request.getHeader(USER_AGENT));
            logger.info("用户访问地址: {}, 来路地址: {}", uri, IpUtil.getIpAddr(request));
        }
        return true;
    }

}

升级springboot为2.1.2.RELEASE版本 移除j2cache支持，移除原因为简化新手用户部署系统配置 更改后台登录为单realm，不再支持多realm 优化日期时间工具类，使用Instant、LocalDateTime、LocalDate实现线性安全 修复Java开发规约中级警告及部分低级警告 增加debug日志输出开关 修复其它已知BUG