【问题标题】:Thymeleaf content assistant not working with Spring BootThymeleaf 内容助手不使用 Spring Boot
【发布时间】:2019-09-16 16:25:38
【问题描述】:

thymeleaf 内容辅助不起作用,当我在 HTML 文件中键入 th: 前缀时,只显示 th:block 提议。

<th:block

我已尝试将 Thymeleaf 处理器提案移至 HTML 文件的 STS/elipse 设置的顶部,但不起作用。

项目是Spring Boot + Thymeleaf,Gradle sn-p:

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 个命名空间更改为另一个不起作用;

嗯,唯一的工作时间是 th 只是替换 HTML th 位置...

<table>
        <tbody>
            <tr th:

【问题讨论】:

  • 你找到解决这个问题的方法了吗?

标签: java spring spring-boot thymeleaf


【解决方案1】:

我也遇到了同样的情况,尝试了很多东西,然后我在 .metadata/ 文件夹中的 .log 文件中看到以下错误:

!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 中安装此插件:帮助-> 安装新软件 -> 添加 ->

我使用上述步骤安装了插件,它对我有用。

Screenshot

我还观察到另一点,它不适用于 jdk16,但它适用于 jdk8。

【讨论】:

    【解决方案2】:

    遇到同样的问题,但升级 Spring Tools 4 后它就消失了。

    【讨论】:

      【解决方案3】:

      我在执行以下步骤时遇到了同样的问题。

      1. 在工作空间的 .metadata 下打开 .log 文件

      2. 在 th 之后打开 Thymeleaf 模板 (html):按 Ctrl+sapce

      3. 检查 .log 文件中的异常 就我而言,这是 groovy 运行时异常,所以我卸载并安装了 groovy 插件 重启 eclipse,thymeleaf 内容助手开始工作。

        [ groovy.lang.GroovyRuntimeException: 找不到匹配的构造函数:org.thymeleaf.extras.eclipse.contentassist.autocomplete.proposals.AttributeProcessorCompletionProposal(org.thymeleaf.extras.eclipse.dialect.xml.ElementProcessor, Integer, Integer , 布尔值)]

      Screenshot

      【讨论】:

      • 我遇到了同样的错误,并通过从 Eclipse Marketplace 安装 Groovy 开发工具解决了这个问题。
      猜你喜欢
      • 2017-04-05
      • 2023-03-17
      • 2019-03-01
      • 1970-01-01
      • 2014-06-12
      • 1970-01-01
      • 2014-05-01
      • 2018-05-01
      • 2017-10-01
      相关资源
      最近更新 更多