gpt4 book ai didi

java - 刷新 SparkJava 服务的静态文件

转载 作者:搜寻专家 更新时间:2023-10-31 19:54:04 27 4
gpt4 key购买 nike

我正在使用 Spark Java 做一个项目。在服务器端,创建了一些图像,我希望它们在客户端可用。由于我有一个静态内容目录,在服务器端创建图像后,我将它放在该目录中。但是,除非我重新启动服务器,否则此文件不可用。我想必须有一种方法可以在运行时刷新 Spark Java 的静态目录文件,以便可以满足运行时创建图像的请求。对吧?

谢谢!

最佳答案

documentation说:

If you use staticFiles.location(...), meaning you keep your static files in the classpath, static resources are copied to a target folder when you build your application. This means you have to make/build your project in order to refresh static files. A workaround for this is to tell Spark to read static files from the absolute path to the src-directory.

因此请改用 staticFiles.externalLocation()

关于java - 刷新 SparkJava 服务的静态文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32181702/

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