Spring Boot Thymeleaf内容助手无法与Sping Boot 配合使用

oyt4ldly  于 2023-03-08  发布在  Spring
关注(0)|答案(5)|浏览(182)

当我键入th时,thymeleaf内容辅助不起作用:前缀,则只显示th:block建议。

<th:block

我曾试图在HTML文件的STS/elipse设置中将Thymeleaf处理器建议移到顶部,但没有成功。
该项目是Sping Boot + Thymeleaf,Gradle代码段:

plugins {
    id 'org.springframework.boot' version '2.1.4.RELEASE'
    id 'java'
}

apply plugin: 'io.spring.dependency-management'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
    implementation "org.springframework.boot:spring-boot-devtools"
}

我添加了html命名空间:

<html xmlns:th="http://www.thymeleaf.org">

将th命名空间更改为另一个命名空间不起作用;
好吧,唯一有效的时间是这只是取代了HTML的位置。。

<table>
        <tbody>
            <tr th:
nhaq1z21

nhaq1z211#

我也遇到了同样的问题,我采取了以下步骤。
1.打开工作空间. metadata下的. log文件
1.打开Thymeleaf模板(html),然后:按Ctrl+空格键
1.检查. log文件中的异常在我的例子中,这是groovy运行时异常,所以我卸载并安装了groovy插件重新启动eclipse和thymeleaf内容助手开始工作。
[groovy. lang.运行时异常:找不到匹配的构造函数:组织. thymeleaf. extras. eclipse.内容辅助.自动完成.建议.属性处理器或完成建议(组织. thymeleaf. extras. eclipse. dialect. xml.元素处理器,整数,整数,布尔)]
Screenshot

svgewumm

svgewumm2#

我也面临着同样的,并尝试了很多事情,然后我看到下面的错误在.log文件内.metadata/文件夹:

!ENTRY org.eclipse.equinox.p2.repository 2 0 2021-09-03 12:04:19.422
!MESSAGE Server returned lastModified <= 0 for https://raw.githubusercontent.com/thymeleaf/thymeleaf-extras-eclipse-plugin/update-site/2.1.2/content.jar

所以我基本上下载了jar从链接:https://raw.githubusercontent.com/thymeleaf/thymeleaf-extras-eclipse-plugin/update-site/2.1.2/content.jar
并通过以下方式在STS中安装了此插件:帮助-〉安装新软件-〉添加-〉〈输入名称并单击存档后选择下载的jar(content.jar)〉
我安装插件使用上述步骤,它为我工作.
Screenshot
还有一点我已经观察到,它不是与jdk 16一起工作,它是与jdk 8一起工作的很好。

whlutmcx

whlutmcx3#

在eclipse.ini中添加以下代码行后,添加Thymeleaf Nature不会再失败,内容辅助也可以工作:

  • -添加打开= java. base/java. lang =全部未命名
gkl3eglg

gkl3eglg4#

在您可以使用vscode编辑器上的thymeleaf扩展作为替代方案之前,它可能会在未来的版本中得到修复。

tktrz96b

tktrz96b5#

得到了同样的问题,但它消失后,升级Spring工具4。

相关问题