凑数记

  1. java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
    添加依赖
<dependency>
    <groupId>commons-codecgroupId>
    <artifactId>commons-codecartifactId>
    <version>1.11version>
dependency>
  1. json格式转换
对于形如 String  aaa = {bookId=2012, bookInfoId=785} 等于号的格式转json
//采用 fastjson
Object json = JSON.toJSONString(aaa);
//采用gson
Gson gson = new Gson();
Object json = gson.toJson(aaa);

你可能感兴趣的:(Java)