java - Thymeleaf 内容助手无法与 Spring Boot 一起使用

标签 java spring spring-boot thymeleaf

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

<th:block

我曾尝试将 Thymeleaf 处理器提案提升到 HTML 文件的 STS/elipse 设置的顶部,但没有成功。

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

好吧,唯一的工作时间是 th 只是替换 HTML th posotion...

<table>
        <tbody>
            <tr th:

最佳答案

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

  1. 打开工作区.metadata下的.log文件

  2. 打开 Thymeleaf 模板 (html):按 Ctrl+sapce

  3. 检查 .log 文件中的异常 在我的例子中,这是 groovy 运行时异常,所以我卸载并安装了 groovy 插件 重启 eclipse,thymeleaf content assistant 开始工作。

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

Screenshot

关于java - Thymeleaf 内容助手无法与 Spring Boot 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55879751/

相关文章:

java - 如何使用 CriteriaQuery 选择抽象服务中的通用对象列表

java - 在 ClassPathXmlApplicationContext 中失败时销毁创建的 bean

java - DefaultRebelLaunchConfigProvider - 未知类型 org.springframework.ide.eclipse.boot.launch

java - 服务层和领域模型的问题

java - 两种渲染方法在两个屏幕上同时工作

java - 从 ArrayList 中获取重复对象

java - 如何从传递给 Thymeleaf 的模型中调用 getters 之类的参数?

spring - Intellij IDEA 提示无法解决 Spring Boot 属性,但它们工作正常

java - Hibernate:将属性字段设置为静态最终对象实例

java - 在 Spring Boot 2.2.5 应用程序中上传文件时出现 MalformedStreamException