![](/img/trans.png)
[英]Intellij idea Compilation Error with Project Lombok in JDK-16
[英]IntelliJ IDEA compilation error with Lombok
我有一個使用集成開發環境 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;
}
還有這個 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;
}
..
}
但我有一個編譯錯誤:
但是當我使用 maven 編譯項目時,一切都很好
只需安裝 lombok 插件並重新啟動 IDEA,希望能正常工作。 您可以按照以下步驟操作:
確保啟用注釋處理,並安裝 intelij lombok 插件
看到這個在此處輸入鏈接描述
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.