我按照here概述的说明为我的MongoDB存储库实现了自定义方法。但是,没有一个自定义方法似乎可用(In [107]: np.allclose(np.polyval(f,x),y)
Out[107]: True
和findAllSeries
似乎没有被春天找到。我检查了命名
SeriesRepository:
uploadSomeSeries
SeriesRepositoryCustom:
@RepositoryRestResource(collectionResourceRel = "series", path = "series", excerptProjection = SeriesProjection.class)
public interface SeriesRepository extends MongoRepository<Series, String>, SeriesRepositoryCustom {
List<Series> findByWinnerId(@Param("id") String id);
}
SeriesRepositoryImpl:
public interface SeriesRepositoryCustom {
ResponseEntity<Void> createSeries(Series series);
}
答案 0 :(得分:1)
搞定了;通过this回答,我必须为我的存储库实现一个控制器,并将调用委托给自定义存储库中定义的方法:
@RepositoryRestController
public class SeriesController {
private final SeriesRepository repository;
@Autowired
public SeriesController(SeriesRepository repo) {
repository = repo;
}
@RequestMapping(value = "/series", method = RequestMethod.POST)
public ResponseEntity<Void> create(@RequestBody Series series) {
return repository.createSeries(series);
}
}