- 使用lombok成员方法输出日志
 
@SpringBootApplication
@Slf4j
public class ReggieTakeOutApplication {
    public static void main(String[] args) {
        SpringApplication.run(ReggieTakeOutApplication.class, args);
        log.info("程序运行开始");
    }
}
- 配置mybatis和数据库不同命名规则映射关系
 
mybatis-plus:
  global-config:
    db-config:
      id-type: assign_id
  configuration:
    map-underscore-to-camel-case: true
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
- 放行前端静态资源
 
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/");
        registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/");
    }
}
- md5加密
参考:https://blog.csdn.net/qq_41437844/article/details/121120227 
password = DigestUtils.md5DigestAsHex(password.getBytes());
- 过滤器
 
// 引导类添加注解
@ServletComponentScan
// LoginCheckConfig
@WebFilter(filterName = "logCheckFilter", urlPatterns = "/*")
public class LogCheckFilter implements Filter {
    public AntPathMatcher pathMatcher = new AntPathMatcher();
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        // 转换类型
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        HttpServletResponse response = (HttpServletResponse) servletResponse;
        // 获取uri
        String uri = request.getRequestURI();
        // 判断是否可以直接放行
        String[] uris = new String[]{
                "/employee/login",
                "/employee/logout",
                "/backend/**",
                "/front/**"
        };
        // 不需要拦截,直接放行
        if (check(uris, uri)) {
            filterChain.doFilter(request, response);
            return;
        }
        // 需要拦截,判断是否登录
        if (request.getSession().getAttribute("employee") != null) {
            filterChain.doFilter(request, response);
            return;
        }
        // 未登录,且需要拦截,返回提示错误信息
        response.getWriter().write(JSON.toJSONString(R.error("NOTLOGIN")));
        return;
    }
    public boolean check(String[] uris, String uri) {
        // 遍历数组
        for (String u : uris) {
            boolean match = pathMatcher.match(u, uri);
            if (match) {
                return true;
            }
        }
        return false;
    }
}
- No primary or single unique constructor found for interface java.util.List
参考:https://blog.csdn.net/weixin_43404791/article/details/105664692