在application.properties的配置文件中加入:
1 spring.resources.static-locations=classpath:/externalFil //可访问此文件夹下的所有内容(内部文件夹地址) 2 或: 3 spring.resources.static-locations=file:D://externalFil //外部文件夹地址
就可以通过 localhost:端口号/文件名 访问该文件夹下的文件了。
原文:https://www.cnblogs.com/nemowang1996/p/12668017.html