我正在构建 spring-boot 2 应用程序,想知道我是否可以以及如何为服务器文件添加静态资源位置,但与应用程序所在的服务器不同。
我使用 application.properties 文件来设置我的资源位置。对于磁盘上的文件来说这不是问题。
spring.resources.static-locations= file:/dir1/fileWithVideo/, file:/http://ip:port/home/seleco/video
它适用于磁盘文件,但不适用于服务器以及它如何工作
最佳答案
要动态获取服务器位置,请在 application.properties 中使用它。
spring.resources.static-locations=file:${app.config.dir:./directory location on server}/file name
关于java - 如何为服务器中的文件添加静态资源位置,但与应用程序所在的服务器不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57109573/