ドメイン オブジェクトをマップしようとすると、次の StackOverflowError 例外が発生します。循環依存関係を無効にするプロパティを無視しようとしました。
私のドメイン モデルの中心にあるのは、User と Exercise を持つ WorkoutSet です。
WorkoutSetMapper からマッピング アノテーションを削除すると、UserMapperImpl と ExerciseMapperImpl が期待どおりに生成されます。
エラー:(15, 1) java: マッピング プロセッサの内部エラー: java.lang.StackOverflowError at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786) at com.sun.tools .javac.code.Types$UnaryVisitor.visit(Types.java:4652) at com.sun.tools.javac.code.Types.supertype(Types.java:2315) at com.sun.tools.javac.code.Types $13.visitClassType(Types.java:1966) at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1955) at com.sun.tools.javac.code.Type$ClassType.accept(Type .java:786) で com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571) で com.sun.tools.javac.code.Types.asSuper(Types.java:1952) でcom.sun.tools.javac.code.Types$13.visitClassType(Types.java:1968) at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1955) at com.sun.tools. javac.code.Type$ClassType.accept(Type.java:786) at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571) at com.sun.tools.javac.code.Types.asSuper( Types.java:1952) com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1975) at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1955) com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786) で com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571) で com.sun .tools.javac.code.Types.asSuper(Types.java:1952) at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1975) at com.sun.tools.javac.code. Types$13.visitClassType(Types.java:1955) at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786) at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit (Types.java:4571) com.sun.tools.javac.code.Types.asSuper(Types.java:1952) com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1975) com.sun. tools.javac.code.Types$13.visitClassType(Types.java:1955) at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786) at com.sun.tools.javac.code .Types$DefaultTypeVisitor.visit(Types.java:4571) at com.sun.tools.javac.code.Types.asSuper(Types.java:1952) at com.sun.tools.javac.code.Types$4.visitClassType( Types.java:921) com.sun.tools.javac.code.Types$4.visitClassType(Types.java:844) com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786) ) com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571) で com.sun.tools.javac.code.Types.isSubtype(Types.java:840) で com.sun. tools.javac.code.Types.isSubtype(Types.java:804) com.sun.tools.javac.model.JavacTypes.isSubtype(JavacTypes.java:98) org.mapstruct.ap.internal.util.workarounds.SpecificCompilerWorkarounds.isSubtype(SpecificCompilerWorkarounds.java:76) org.mapstruct .ap.internal.util.workarounds.TypesDecorator.isSubtype(TypesDecorator.java:68) org.mapstruct.ap.internal.model.common.Type.isSubType(Type.java:638) org.mapstruct.ap.internal .model.common.Type.isCollection(Type.java:628) の org.mapstruct.ap.internal.model.common.Type.isCollectionOrMap(Type.java:624) の org.mapstruct.ap.internal.model.common .Type.getAlternativeTargetAccessors(Type.java:598) at org.mapstruct.ap.internal.model.common.Type.getPropertyWriteAccessors(Type.java:419) at org.mapstruct.ap.internal.model.source.TargetReference$BuilderFromTargetMapping .org.mapstruct.ap.internal.model.source.TargetReference$BuilderFromTargetMapping.build(TargetReference.java:120) の getTargetEntries(TargetReference.java:144) org.mapstruct.ap.internal.model.source.Mapping.init( Mapping.java:227) org.mapstruct.ap.internal.model.source.SourceMethod$Builder.build(SourceMethod.java:207) org.mapstruct.ap.internal.processor.MethodRetrievalProcessor.getMethodRequiringImplementation(MethodRetrievalProcessor.java: 257) org.mapstruct.ap.internal.processor.MethodRetrievalProcessor.getMethod(MethodRetrievalProcessor.java:193) で org.mapstruct.ap.internal.processor.MethodRetrievalProcessor.retrieveMethods(MethodRetrievalProcessor.java:148) で org.mapstruct.ap org.mapstruct の .internal.processor.MethodRetrievalProcessor.retrieveMethods(MethodRetrievalProcessor.java:163)。ap.internal.processor.MethodRetrievalProcessor.retrieveMethods(MethodRetrievalProcessor.java:163) org.mapstruct.ap.internal.processor.MethodRetrievalProcessor.retrieveMethods(MethodRetrievalProcessor.java:163) org.mapstruct.ap.internal.processor.MethodRetrievalProcessor. org.mapstruct.ap.internal.processor.MethodRetrievalProcessor.retrieveMethods での retrieveMethods(MethodRetrievalProcessor.java:163) .......
私のドメインクラスは次のとおりです
@Entity
public class User implements FirstClassDomainObject {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
private String email;
...
@Entity
public class Exercise implements FirstClassDomainObject {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
private String description;
...
@Entity
public class WorkoutSet implements FirstClassDomainObject {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private int repetition;
private double wight;
private LocalDateTime timestamp;
@ManyToOne
private Exercise exercise;
@ManyToOne
private User user;
...
私のDTOクラスは次のとおりです
public class UserResource implements ResourceObject {
private Long id;
private String name;
private String email;
...
public class ExerciseResource implements ResourceObject {
private String name;
private String description;
...
public class WorkoutSetResource implements ResourceObject {
private int repetition;
private double wight;
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime timestamp;
private ExerciseResource exercise;
private UserResource user;
...
私のマッパーインターフェースは次のとおりです
@Mapper(componentModel = "spring")
interface UserMapper extends ClassMapper<User, UserResource> {
@Override
default List<Class<?>> getSupportedClasses() {
return Lists.newArrayList(User.class, UserResource.class);
}
}
@Mapper(componentModel = "spring")
interface ExerciseMapper extends ClassMapper<Exercise, ExerciseResource> {
@Override
default List<Class<?>> getSupportedClasses() {
return Lists.newArrayList(Exercise.class, ExerciseResource.class);
}
}
@Mapper(componentModel = "spring", uses = {UserMapper.class, WorkoutSetMapper.class})
interface WorkoutSetMapper extends ClassMapper<WorkoutSet, WorkoutSetResource> {
@Override
default List<Class<?>> getSupportedClasses() {
return Lists.newArrayList(WorkoutSet.class, WorkoutSetResource.class);
}
}
ClassMapper は次のように定義されます
public interface ClassMapper<D extends DomainObject, R extends ResourceObject> {
R map(D domainObject);
D map(R resourceObject);
List<Class<?>> getSupportedClasses();
}
テキストの壁を避けるために getter メソッドと setter メソッドを省略しましたが、コード ベース全体はhttps://github.com/tonsV2/Lift-Log-Backendにあります。私が間違ったことについての手がかりはありますか?