错误"No converter found capable of converting from type [java.lang.String] to type [com.marter.travel.



现在面临的错误是"找不到能够从类型 [java.lang.String] 转换为类型 [com.marter.travel.model.Picture]

"
import java.time.LocalDateTime;
import java.util.ArrayList;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document (collection = "tourpackage")
public class TourPackage {
    private ArrayList<Picture> picture;
    public ArrayList<Picture> getPicture() {
        return picture;
    }
    public void setPicture(ArrayList<Picture> picture) {
        this.picture = picture;
    }
}

如果您使用的是 Spring 数据并且Picture是另一个映射的类 @Document .您必须在ArrayList<Picture>上添加@DBRef注释

@DBRef
private ArrayList<Picture> picture;

相关内容

最新更新