当我使用gradle构建spring-boot应用程序时,应该在哪里存储静态资源? [英] Where should I store static resources when I build spring-boot app by gradle?
问题描述
我找到了在 / src / main / webapp /
和 / src / main / resources / static /
。有什么区别,什么是在 spring-boot
应用程序中存储静态文件的最佳位置
I've found samples that stores static files in /src/main/webapp/
and /src/main/resources/static/
. What's the difference and what's the best place to store static files in spring-boot
app?
推荐答案
如果您的资源位于 src / main / webapp
中,则表明您正在构建WAR存档。而对于JAR src / main / resources
则更合适(例如,如果它是启动应用程序,则在 / static
中)。这取决于你,但如果你想把东西放在非标准的地方 - 你只需要配置构建系统来理解你的意思。
If your resources are in src/main/webapp
that suggests you are building a WAR archive. And for a JAR src/main/resources
is more appropriate (eg in /static
if it's a boot app). It's up to you though if you want to put stuff in non standard places - you just have to configure the build system to understand what you mean.
这篇关于当我使用gradle构建spring-boot应用程序时,应该在哪里存储静态资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!