为什么 lombok 不创建 getter?

Why lombok doesn't create getter?

我导入了一个使用 lombok 来减少代码的项目,但出现错误 "The method getBooks() is undefined for the type Author",其中 Book 和 Author 是两个实体。

this.getBooks().add(book);
book.setAuthor(this);

书Class使用了这样的提示,我也得到了警告"The type Builder is deprecated",我该如何解决这个问题?

@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(exclude = "id")
@ApiObject(name = "Book", group = DocumentationConstants.GROUP_LIBRARY,   description = "Represents a book. Every book has an <code>Author</code> and a price.")
public class Book {
...
}

我不知道有关 getBooks 的问题,但要解决弃用警告,您可能应该将导入从 lombok.experimental.Builder 替换为 lombok.Builder

披露:我是 Lombok 开发人员。