**结束。**此问题需要详细的调试信息。它目前不接受答案。
**想改进这个问题吗?**更新问题,使其成为堆栈溢出的主题。
8天前关门了。
改进这个问题
当我将mapstruct从“1.3.1.final”升级到“1.4.2.final”时,我面临这个错误。 CompanyType does not have an accessible constructor.
mapstruct无法将枚举Map到此版本的mapstruct中的字符串,并且我的所有Map类都面临此错误。我需要这个版本是因为这个版本的一些特性。请帮我解决这个例外。
我的代码:
@Entity
@Getter
@Setter
@Table(name = "CORE_COMPANY")
@NoArgsConstructor
@AllArgsConstructor
public class Company {
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
private String id;
@NotNull
@Size(min = 2, max = 50)
@Column(name = "NAME", nullable = false)
private String name;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "COMPANY_TYPE", nullable = false)
private CompanyType companyType;
}
@Getter
@AllArgsConstructor
public enum CompanyType {
insurance("Insurance", "insurance"),
Shipping("Shipping", "naviportans");
private final String title;
private final String latinTitle;
}
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CompanyDTO {
private String id;
private String name;
private String companyType;
private String companyTypeLatinTitle;
}
@Mapper(componentModel = "spring")
public interface CompanyMapper extends EntityMapper<CompanyDTO, Company> {
CompanyMapper INSTANCE = Mappers.getMapper(CompanyMapper.class);
@Mapping(target = "companyTypeLatinTitle", source = "companyType.latinTitle")
CompanyDTO toDto(Company entitiy) ;
@InheritInverseConfiguration
Company toEntity(CompanyDTO dto) ;
}
暂无答案!
目前还没有任何答案,快来回答吧!