日常问题小记(交接篇)

  金三银四,同事离职,代码交接,常见问题汇总

1、mysql from_unixtime时间戳日期转换异常

  接口调sql执行时间戳日期转换时,时间偏差了13个时区。

  问题原因:mysql数据库时区被修改

show VARIABLES LIKE '%time_zone%';
set global time_zone='+8:00';
set time_zone='+8:00';
flush privileges;

2、加载本地静态资源

  springboot项目变更为2.0.3,最初的通过继承WebMvcConfigurerAdapter类,配置本地路径以加载静态资源的方式失效。新方法采用直接实现WebMvcConfigurer的方式来实现。

@Configuration
public class WebAppConfig implements WebMvcConfigurer {
    
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/image/**").addResourceLocations("file:/home/lab/image/");
    }

}

3、新建git仓库,idea连接报错失效

  新建git远程仓库时,报错:Could not read from remote repository,而ssh、clone都没有问题

  原因在于shadowsocks本地服务变更,进而造成连接异常。为避免同类问题,setting -- Http proxy -- no proxy

原文地址:https://www.cnblogs.com/nyatom/p/10694893.html