Intellij idea 什么';s springboot&;中参考资料下的static和templates文件夹之间的区别;百里香项目?
我是新来的百里香和春靴 我用IntelliJ IDEA中的thymeleaf创建了一个springboot项目,其中有“New project”->“Spring Initializer” 然后我得到一个项目,其结构如下所示Intellij idea 什么';s springboot&;中参考资料下的static和templates文件夹之间的区别;百里香项目?,intellij-idea,spring-boot,thymeleaf,Intellij Idea,Spring Boot,Thymeleaf,我是新来的百里香和春靴 我用IntelliJ IDEA中的thymeleaf创建了一个springboot项目,其中有“New project”->“Spring Initializer” 然后我得到一个项目,其结构如下所示 demo |+-src/main | +-java | +-resources | static | templates | application.properties |-pom.x
demo
|+-src/main
| +-java
| +-resources
| static
| templates
| application.properties
|-pom.xml
问题是我应该在资源下的静态和模板中放置什么?他们之间有什么区别
我想具有thymeleaf属性的.html文件应该放在模板中。静态html、css和js怎么样
谢谢。这些文件夹是组织文件的一种方式。这些
静态
和模板
文件夹具有特殊意义,因为它已经成为开发人员组织前端文件(如css
、js
、html
等)的共识。根据我的理解,我们应该放置像css
,js
,图像
这样的文件,这些文件支持在运行时不会在整个应用程序中更改的网页。例如:您的设计不会改变css
文件中的内容。在templates
中,我们应该放置html
文件。如果同时添加html和其他文件,则很难组织文件。模板
文件夹是放置所有模板的地方。这是一个默认目录(默认情况下,spring将在其中查找任何模板)
static
文件夹用于提供web静态内容、所有css、js、html等(也是spring的默认文件夹搜索)
我应该将没有thymeleaf属性的html文件放在哪里?它们在运行时不会更改。仍然将它们添加到
templates
文件夹中,其中包括web应用程序的结构和布局。我应该将带有index.html的angular应用程序放在哪里?在/static/public或/templates中?不幸的是,当使用类似于th:src=“@{/images/logos/mylogo.png}”的东西时,IntelliJ似乎没有为Thymeleaf模板的静态文件夹中的路径/文件提供代码完成功能。当您运行应用程序时,它可以正常工作,但是没有代码完成,就像您在使用模板时对标准HTMLsrc=
标记一样。@siriusbit您可以在我添加的工件中使用web描述符,同时使用“/”和IntelliJ来完成代码。