gpt4 book ai didi

java - Thymeleaf 源 jar 中未定义空构造函数

转载 作者:行者123 更新时间:2023-11-30 02:52:22 24 4
gpt4 key购买 nike

我正在从下面的网址学习 Thymeleaf

http://www.concretepage.com/spring-4/spring-4-security-thymeleaf-integration-custom-login-page-and-logout-example-with-csrf-token-using-javaconfig

我没有使用 Gradle,而是从 Thymeleaf 官方页面下载了所有必需的 jar。为什么 Eclipse 在 ThymeleafConfig 类中抛出编译错误

ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();

错误是“构造函数 ServletContextTemplateResolver() 未定义”。经过深入研究,我发现这个构造函数需要 servlet 上下文作为输入。网络上的所有其他示例都使用类似的方法。我的问题是,如果 Thymeleaf 源 jar 中未定义空构造函数,那么每个人都如何使用它,或者在我的情况下可以采取什么措施来解决它?

最佳答案

关于

On deep research i found that this constructor requires servlet context as input.

您正在查看最多的recent version类(class)的。 The constructor确实需要 ServletContext 参数。

但是,情况并非总是如此,在 previous versions 中,constructor声明没有参数。

您正在查看的教程可能使用的是那些旧版本。使用适合您环境的选项。

关于java - Thymeleaf 源 jar 中未定义空构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38233992/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com