1
我今天尝试向我的API/DB添加一个新的集合,并且当我尝试POST或GET,我得到这个500错误响应:SpringBoot MongoDB返回“Id必须可赋值给Serializable!类[null]的对象必须是接口java.io.Serializable的一个实例”
{
"cause": null,
"message": "Id must be assignable to Serializable! Object of class [null] must be an instance of interface java.io.Serializable"
}
但是,POST实际上是成功的,我可以看到数据库中的新数据。
型号:
@Setter
@Getter
public class League {
private String name;
private String shortName;
private List<Team> teams;
}
库:
@RepositoryRestResource(collectionResourceRel = "leagues", path = "leagues", excerptProjection = LeagueProjection.class)
public interface LeagueRepository extends MongoRepository<League, String> {
}
投影:
@Projection(name="LeagueProjection", types={League.class})
public interface LeagueProjection {
String getName();
String getShortName();
}
我没有做任何事情规范IAL。我有多个其他集合,工作正常。
我正在使用spring-boot 1.5.1。
谢谢!