简体   繁体   English

Spring Boot 4.9.0 ThymeLeaf 自动完成在 Eclipse 中不起作用

[英]Spring Boot 4.9.0 ThymeLeaf auto-complete not working in Eclipse

I would like to use SpringBoot with Thymeleaf. I created a controller, which looks like this:我想将 SpringBoot 与 Thymeleaf 一起使用。我创建了一个 controller,如下所示:

I have the Controller Structure like this:我有这样的 Controller 结构:

@Controller
public class AboutController {

    @RequestMapping(value="/about" ,method=RequestMethod.GET)
    public String about()
    {
        System.out.println("inside about");
        return "about";
    }
}

And having the dependency in pom.xml:并在 pom.xml 中具有依赖性:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

In about.html file在 about.html 文件中

<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Document</title>
</head>
<body>
    <h1>Hi Thyme leaf Example</h1>
    <h1 th:  ></h1>
</body>
</html>

The suggestion/auto-complete is not showing of th: ...建议/自动完成未显示:...

I am using我在用

  • JDK 1.8 JDK 1.8
  • Spring boot 2.4.2 Spring 开机 2.4.2
  • Thymeleaf 3.0 Thymeleaf 3.0

I don't think this has to do with Spring Boot at all, I think you need the Thymeleaf Eclipse plug-in from https://github.com/thymeleaf/thymeleaf-extras-eclipse-plugin to have that completion.我认为这根本与 Spring Boot 无关,我认为您需要来自https://github.com/thymeleaf/thymeleaf-extras-eclipse-plugin的 Thymeleaf Eclipse 插件才能完成。

Right click project icon ----> click Maven ----> Update project ----> check all as shown in blow pic ( [1]: https://i.stack.imgur.com/S3Dnh.png )-----> Ok ------> wait for the project to update.右击项目图标----> 点击Maven ----> 更新项目----> 全部勾选如下图( [1]: https://i.stack.imgur.com/S3Dnh.png )-----> 确定 ------> 等待项目更新。 -----> Restart STS -----> 重启 STS

if still it does not work goto help ----> install new software ----> manage ----- Select Thymeleaf -----> reload-----> apply and close -----> Restart STS如果仍然不起作用,请转到帮助 ----> 安装新软件 ----> 管理 ----- Select Thymeleaf -----> 重新加载 -----> 应用并关闭 ----- > 重启STS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM