【问题标题】:How does delete mapping work with Spring WebFlux and Cassandra database?删除映射如何与 Spring WebFlux 和 Cassandra 数据库一起使用?
【发布时间】:2021-10-21 16:26:13
【问题描述】:

我正在尝试了解 Spring Web Flux。我能够得到@getmapping 来把我的json 参数还给我。在 cassandra 数据库中,我能够使用存储库中的该命令删除一行,但我无法从命令行中删除一行。大家有什么推荐的?

//This code is in my controller 
//It's supposed to call method when I type in my terminal "curl localhost:8080/orders/delete/1"
   @DeleteMapping("/delete/{id}")
    public Mono<Integer> deleteOrder(@PathVariable("id") int id){

//This code is in my service called after the top portion
    public Mono<Integer> deleteOrder(int id) {return orderRepository.deleteOrder(id);} {
//And then in my repository this should be the last called method 
public Mono<Integer> deleteOrder(int uuid) {
      //  log.info("Attempting to delete");
        Flux.from(
                session.executeReactive(
                        SimpleStatement.builder("DELETE FROM LightNfresh.orders WHERE order_id = ?")
                            .addPositionalValue(uuid)
                            .build()))
                .subscribe();
        return Mono.just(uuid);
    }

【问题讨论】:

    标签: java spring cassandra reactive webflux


    【解决方案1】:

    原来这只是我的 curl 命令。 应该是 curl -X "DELETE" localhost:8080/orders/delete/1 感谢所有正在研究它的人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-09
      • 2015-08-24
      • 2018-11-14
      • 1970-01-01
      • 1970-01-01
      • 2020-03-21
      • 1970-01-01
      • 2011-01-28
      相关资源
      最近更新 更多