gpt4 book ai didi

java - 如何为服务器中的文件添加静态资源位置,但与应用程序所在的服务器不同

转载 作者:行者123 更新时间:2023-12-02 02:50:54 25 4
gpt4 key购买 nike

我正在构建 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com