windows

  1. URL resource = TmpFileHandle.class.getClassLoader().getResource(tplName);
  2. Objects.requireNonNull(resource, "模板【" + tplName + "】文件不存在");
  3. File resourceFile = new File(resource.getPath());

linux

  1. ClassPathResource classPathResource = new ClassPathResource(tplName);
  2. // 获取文件输入流
  3. InputStream inputStream = classPathResource.getInputStream();
  4. List<String> list = IOUtils.readLines(inputStream);

docker

  1. FROM common-registry.clamc.com:5000/common/java:8-jre
  2. VOLUME /tmp
  3. ADD ./target/operation-xxx-ai.jar /app/
  4. ADD ./target/classes/tmpl/ClauseTmpl.tmpl /app/
  5. RUN echo "Asia/Shanghai" > /etc/timezone # 解决时间差
  6. RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # 解决时间差
  7. ENTRYPOINT exec java ${JAVA_OPTS} -Duser.timezone=UTC+08:00 -Djava.security.egd=file:/dev/./urandom -jar /app/operation-xxx-ai.jar ${RUN_ARGS}
  8. EXPOSE 9417
  1. File file = ResourceUtils.getFile(tplName);
  2. Path path = file.toPath();
  3. List<String> list = Files.readAllLines(path);