code: public static <T> String serialize(T obj) {
          if (obj == null) {
              return "";
          }
          ByteArrayOutputStream bos = null;
          ObjectOutputStream oos = null;
          try {
              bos = new ByteArrayOutputStream();
              oos = new ObjectOutputStream(bos);
              oos.writeObject(obj);
              return CommonUtils.bytesToBase64Str(bos.toByteArray());
          } catch (Exception e) {
              throw new RuntimeException("serialize session error", e);
          } finally {
              CommonUtils.closeIOStream(null, bos);
              CommonUtils.closeIOStream(null, oos);
          }
      }
docs: 将一个对象序列化成字符串
  
  @param obj 被序列化的对象,该对象必须实现{@link java.io.Serializable}接口
  @param <T>
  @return 返回对象被序列化后的字符串