Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Thymeleaf不认识龙姆博克的能手和二传手_Java_Intellij Idea_Spring Boot_Thymeleaf_Lombok - Fatal编程技术网

Java Thymeleaf不认识龙姆博克的能手和二传手

Java Thymeleaf不认识龙姆博克的能手和二传手,java,intellij-idea,spring-boot,thymeleaf,lombok,Java,Intellij Idea,Spring Boot,Thymeleaf,Lombok,已安装Lombok插件。使用Intellij15。模型的结构显示了getter和setter,但我从Thymeleaf得到以下错误 错误: bean类[com.blog.domain.Post]的无效属性“postTitle”:bean属性“postTitle”不可读或具有无效的getter方法:getter的返回类型是否与setter的参数类型匹配 模型: @Entity public @Data class Post { @Id @GeneratedValue pr

已安装Lombok插件。使用Intellij15。模型的结构显示了getter和setter,但我从Thymeleaf得到以下错误

错误:

bean类[com.blog.domain.Post]的无效属性“postTitle”:bean属性“postTitle”不可读或具有无效的getter方法:getter的返回类型是否与setter的参数类型匹配

模型:

@Entity
public @Data class Post {

    @Id
    @GeneratedValue
    private Long id;

    @NotEmpty
    private String postTitle;

    @NotNull
    @ManyToOne
    private Author postAuthor;

    @NotNull
    @Temporal(TemporalType.DATE)
    private Date postDate;

    @Column(columnDefinition = "TEXT")
    private String postTeaser;

    @Column(columnDefinition = "TEXT")
    private String postBody;

}
加载表单的控制器方法:

@GetMapping("/create")
public String postForm(Post post, Model model) {
    model.addAttribute("authors", authorService.getAllAuthors());
    return "postform";
}
发生错误的字段:

<input id="postTitle" type="text" th:field="*{postTitle}" />


知道我哪里出错了吗?手动添加getter和setter可以解决这个问题。lombok在这里做什么打破了它?

我使用了一个名为“isEnabled”的布尔值。将其重命名为“已启用”有效。但不确定原因。

是否显示控制器代码?因为我不能复制它,在我的机器上一切都很好。把控制器的方法放到原始的帖子上。你的输入是在表单中,对吗?出于测试目的,我将添加简单的文本字段

,并使用
model.addAttribute(“post”,new post())进行检查在控制器获取方法中。这很奇怪。你没有任何不寻常的龙目龙目配置吗?是的,它在表格中。没有什么不寻常的,除了我使用的是1.4.0 M3引导版本。这可能是原因吗?不知道,但我测试了1.3.5版本。也许值得尝试一下,如果可能,请添加一个解决方案的示例。