spring-data-reference (arangodb) 的@Ref 是使用急切还是延迟获取引用对象?

Is @Ref of spring-data-reference (arangodb) uses eager or lazy fetching of the referenced object?

我正在编写一个包含一些引用对象的架构。我试图了解引用对象的实际获取是惰性的还是急切的。

arangodb-spring-data 3.2.5 开始,引用对象的默认提取应该是急切的,正如您在 @Ref 注释 class.

中看到的那样

Ref.class

package com.arangodb.springframework.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.data.annotation.Reference;

/**
 * Annotation to indicate that the annotated field is stored as a document in
 * another collection instead of a nested document. The document {@literal _id}
 * of that document is stored as a reference in the stored field.
 *
 * @author Mark Vollmary
 *
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD })
@Reference
public @interface Ref {

    /**
     * Whether the entity should be loaded lazily
     */
    boolean lazy() default false;

}

要使引用的数据延迟加载,您应该使用

对其进行注释
@Ref(lazy = true)