设置跨域访问的两种解决办法 1. 通过在controller类上或方法上添加@CrossOrigin注解实现跨域访问(推荐使用) 2. 添加自定义拦截器 public class CORSInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { response.setHeader("Access-Control-Allow-Origin","*"); response.setHeader("Access-Control-Allow-Credentials","true"); response.setHeader("Access-Control-Allow-Methods","GET,PUT,POST,DELETE,HEAD,OPTIONS"); response.setHeader("Access-Control-Max-Age","3600"); response.setHeader("Access-Control-Allow-Headers","x-requested-with,content-type"); return super.preHandle(request, response, handler); } } @Component public class InterceptorConfiguration extends WebMvcConfigurationSupport { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new CORSInterceptor()); super.addInterceptors(registry); } }
遇到的坑 时间戳默认为秒级 在创建表时,如果你为某个字段设置了timestamp或datetime(其实一样)类型,那么它默认为秒级的例如:2018-06-17 22:01:36,然而使用Javanew Date()出来的为毫秒级例如2018-06-17 22:01:36.048,当你使用使用预编译sql进行判等时当然永远不会匹配。
1.进入Recovery Mode(恢复模式) 开机,在Grub启动菜单选择Advance Options,如果没有Grub启动菜单出现,开机时按方向键即可出现。
docker-compose up
docker run -p 80:80 -v /data:/data -d nginx:latest docker start myrunoob docker kill -s KILL dockerID docker rm -f db01 db02 docker pause db01 docker create --name myrunoob nginx:latest docker exec -it mynginx /bin/sh /root/runoob.sh docker ps docker inspect --format='' docker top mymysql docker attach --sig-proxy=false mynginx docker logs -f mynginx docker export -o mysql-`date +%Y%m%d`.tar a404c6c174a2 docker port mymysql docker commit -a "runoob.com" -m "my apache" a404c6c174a2 mymysql:v1 docker cp /www/runoob 96f7f14e99ab:/www/ docker diff mymysql docker login -u 用户名 -p 密码 docker pull java docker push myapache:v1 docker search -s 10 java docker images docker rmi -f runoob/ubuntu:v4 docker build -t runoob/ubuntu:v1 . docker history runoob/ubuntu:v3 docker save -o my_ubuntu_v3.tar runoob/ubuntu:v3 docker import my_ubuntu_v3.tar runoob/ubuntu:v4 docker info docker version
修改源列表 # 备份 sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup # 新建sources.list文件 sudo vim /etc/apt/source.list 将下面的直接复制过去 # USTC (University of Science and Technology of Thina) # xenial is ubuntu 16.04 version deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
Instruction(指令)
系统安装 在用户根目录下找到.m2/setting.xml文件,打开并添加如下内容: <mirrors> <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> </mirror> </mirrors> Idea编译器内嵌 在Idea安装根目录下找到plugins\maven\lib\maven3\conf\settings.xml文件,打开并添加配置,配置信息同上。