Local development and docker container of spring boot deployment differences:
1. The difference between file path and file name of the case:
Local development environment for windows operating system, are case insensitive, but case-sensitive container
2. docker within the time zone of the container requires a separate set
And the time difference in the docker GMT 8 hours, so the need to set the time zone, can be modified in the dockerfile, or modify the deployment of yaml file: name: TZ value: Asia / Shanghai
3. Get template file:
After the container of the file under the Resource exists in this jar file inside, on the disk is not the existence of the true path, a path which is actually located inside the jar. Therefore, the method can not obtain the file by ResourceUtils.getFile or this.getClass () getResource ( "") is correct, it can only be obtained in the form of stream:
The correct wording:
InputStream stream = this.getClass().getClassLoader().getResourceAsStream(/template/opinion/33.docx")
or:
ClassPathResource resource = new ClassPathResource("/template/opinion/33.docx"); // load the template file and replace the agency Opinion data XWPFTemplate Template = XWPFTemplate.compile (resource.getInputStream ()) .render(model);
4. default within the container does not support Chinese fonts. If you need to print as pdf, then you need to install fonts