Docker容器开机自动启动

如果创建时未指定 --restart=always,可以通过update命令设置

docker update --restart=always xxx  

取消重启

docker run --restart=no xxx
2019/4/24 posted in  Docker

Docker安装Redis

docker pull redis
docker run -p 6379:6379 -d redis:latest redis-server
2019/4/24 posted in  Docker

Docker安装Zookeeper

docker pull zookeeper
docker run --privileged=true -d --name zookeeper --publish 2181:2181  -d zookeeper:latest
2019/4/24 posted in  Docker

Docker安装MySQL

docker pull mysql

然后执行

docker run -d -e MYSQL_ROOT_PASSWORD=root --name mysql -v /Users/dengyuanke/dev/mysql_data:/var/lib/mysql -p 3306:3306 mysql
阅读更多   2019/4/24 posted in  Docker MySQL&MariaDB

集合CollectionUtils的操作方法

集合判断:
例1: 判断集合是否为空:
CollectionUtils.isEmpty(null): true
CollectionUtils.isEmpty(new ArrayList()): true
CollectionUtils.isEmpty({a,b}): false

例2: 判断集合是否不为空:
CollectionUtils.isNotEmpty(null): false
CollectionUtils.isNotEmpty(new ArrayList()): false
CollectionUtils.isNotEmpty({a,b}): true

2个集合间的操作:
集合a: {1,2,3,3,4,5}
集合b: {3,4,4,5,6,7}
CollectionUtils.union(a, b)(并集): {1,2,3,3,4,4,5,6,7}
CollectionUtils.intersection(a, b)(交集): {3,4,5}
CollectionUtils.disjunction(a, b)(交集的补集): {1,2,3,4,6,7}
CollectionUtils.disjunction(b, a)(交集的补集): {1,2,3,4,6,7}
CollectionUtils.subtract(a, b)(A与B的差): {1,2,3}
CollectionUtils.subtract(b, a)(B与A的差): {4,6,7}

2019/3/4 posted in  Java

SpringBoot的Controller接收多个实体

Controller接收多个实体,网上有很多方法,我使用的是Map参数这种方法,在方法的参数里面写:@RequestBody Map map
然后在方法体里面得到前端从传入的两个实体:

ClassA classa = JSON.parseObject(JSON.toJSONString(map.get("classa")), ClassA.class);
        ClassB classb = JSON.parseObject(JSON.toJSONString(map.get("classb")), ClassB.class);

完成!

2019/2/19 posted in  SpringBoot

使用 docker 运行 mongodb

1,进入终端,获取 docker 镜像
执行:docker pull mongo拉取最新的 mongo 镜像;
等待下载完成。

2,运行 mongo 容器
执行:docker run --name cool-mongo -p 27017:27017 -d mongo
即运行了一个新的 mongo 容器,通过 mongodb 的可视化客户端即可访问。

2019/2/16 posted in  Docker MongoDB

SpringBoot2.0 设置文件上传大小限制

在SpringBoot2.0之前,使用的是

spring:
  http:
   multipart:
    max-file-size: 100MB 
    max-request-size: 1000MB

在SpringBoot2.0后是

spring:
  servlet:
    multipart:
      max-file-size: 1024MB
      max-request-size: 1024MB
2019/1/4 posted in  SpringBoot

docker pull 报错 :Error response from daemon: Get https://registry-1.docker.io/v2/library/xxx/manifests/latest: unauthorized: incorrect username or password

阅读更多   2018/12/17 posted in  Docker

An Errors/BindingResult argument is expected to be declared immediately after the model attribute, the @RequestBody or the @RequestPart arguments to which they apply

今天测试接口的时候,出现了这个错误

An Errors/BindingResult argument is expected to be declared immediately after the model attribute, the @RequestBody or the @RequestPart arguments to which they apply

阅读更多   2018/11/28 posted in  SpringBoot