Lombok excluding field with @ToString.Exclude is not working
问题 I'm using Lombok to remove boilerplate code. I'm attempting to print out an entity to the console but I'm getting a StackOverflowError. The entity has a bidirectional relationship with another entity, so I want to exclude this entity from the toString method. My entity looks like this: @Entity @Data public class Foo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long fooId; private String name; @ManyToOne @JoinColumn(name = "barId") @EqualsAndHashCode.Exclude @ToString