/*
 * Copyright (c) 2017-2018.  放牛极客<l_iupeiyu@qq.com>
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *      http://www.apache.org/licenses/LICENSE-2.0
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 * </p>
 *
 */

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;

@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