Welcome to Qi-U Community for programmer and developer-Open, Learning and Share

Categories

0 votes
163 views
in Technique[技术] by (31.9m points)

spring boot打包后在服务器上无法读取resources下文件

打包后所有工程都是jar包,服务器上没法读到resources下的文件,网上找了很多文章说的解决办法都不行,各种读取方法都试过了就是读不到文件,以前用spring mvc的时候从来没有这种情况,对spring boot的打包运行机制不是很了解,不知道有没有解决办法?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (31.9m points)

1:确定jar中是不是有文件
2:如果是其他类型的文件(比如office文件),默认配置下会被你编译,文件相当于损坏了,读取也会出问题


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Qi-U Community for programmer and developer-Open, Learning and Share
...