[英]IntelliJ IDEA compilation error with Lombok
I have a SpringBoot project with Lombok using the integrated development environment IntelliJ IDEA, with this object:我有一个使用集成开发环境 IntelliJ IDEA 的带有 Lombok 的 SpringBoot 项目,带有这个 object:
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(NON_NULL)
@Entity
@Table(name = "t_user_role")
public class UserRole implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonIgnore
private Long id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "user_id")
@JsonIgnore
private User user;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "role_id")
private Role role;
}
and also this object:还有这个 object:
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(NON_NULL)
@Entity
@Table(name="t_user")
public class User implements Serializable, UserDetails {
..
@Override
@JsonIgnore
public Collection<? extends GrantedAuthority> getAuthorities() {
Set<GrantedAuthority> authorities = new HashSet<>();
userRoles.forEach(ur -> authorities.add(new Authority(ur.getRole().getName())));
return authorities;
}
..
}
but I have a compilation error:但我有一个编译错误:
but when I compile the project using maven everything is fine但是当我使用 maven 编译项目时,一切都很好
Just install lombok plugin and restart the IDEA, hope will work.只需安装 lombok 插件并重新启动 IDEA,希望能正常工作。 You can follow the steps below:
您可以按照以下步骤操作:
Be sure you enable annotation processing, and install intelij lombok plugin确保启用注释处理,并安装 intelij lombok 插件
See this one enter link description here看到这个在此处输入链接描述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.