Take a note
After deploying the code to the test environment this morning, it’s time to test the requirements
FileNotFoundException, it was found that an error was reported when getting the font path. It’s strange that this problem was not found during local debugging.
Caused by: java.io.FileNotFoundException: /opt/supplier_web/supplier_web.jar!/BOOT-INF/lib/supplier_web.web-0.0.1.jar!/font/simsun.ttf (No such file or directory)
The problem code is as follows:
The troubleshooting found the following problems:
This is because spring attempts to access the file system path after packaging, but cannot access the path in the jar.
terms of settlement:
ClassPathResourcesolve the problem.