小编Sri*_*ini的帖子

mvn -U clean编译和mvn clean编译之间的区别

我使用了这两个命令来解决项目中的依赖关系问题。mvn -U clean compile解决的问题。但是我不知道它们之间的区别。请说明这些命令之间的区别以及何时使用mvn clean compilemvn -U clean compile

maven

4
推荐指数
1
解决办法
5598
查看次数

无法在多文档事务中创建名称空间(MongoDB 4.0,Spring Data 2.1.0,Spring Boot)

有关Spring引导,Mongo4.0,Spring数据应用程序的问题。

我已经从MongoDB 3.6.x升级到MongoDB 4.0,并将Spring data 2.0.x升级到Spring-data 2.1.0,以便在将数据插入多个文档时进行事务管理。但是在这里,我在创建数据库,收集并将文档插入到收集中时会遇到此问题。

问题

Cannot create namespace sampledb_200.demo in multi-document transaction 
Run Code Online (Sandbox Code Playgroud)

这里sampldb_200是数据库名称,demo是集合名称。

在早期的mongodb3.6.X版本Spring Data 2.0.x中,即使数据库和集合都不存在,我也可以同时进行数据库,集合创建,文档插入。

在一个功能和数据库中,使用Spring Data 2.1.0,MongoDB 4.0,数据库,集合创建和插入不会发生,必须明确地完成集合创建。

java mongodb spring-data spring-data-mongodb spring-boot

3
推荐指数
1
解决办法
1504
查看次数

Clojure,Compojure:Path参数总是在Compojure API中作为String传递

我传递路径参数来从数据库中获取数据.

终点

http://localhost:3000/hello/1000

GET方法代码

(ns clojure-dauble-business-api.core
  (:require [compojure.api.sweet :refer :all]
            [ring.util.http-response :refer :all]
            [clojure-dauble-business-api.logic :as logic]
            [clojure.tools.logging :as log]
            [clojure-dauble-business-api.domain.artwork])
  (:import [clojure_dauble_business_api.domain.artwork Artwork]))

(defapi app
  (GET ["/hello/:id", :id #"[0-9]+"] [id]
    (log/info "Function begins from here" id)
    (ok {:artwork (logic/artwork-id id)})))
Run Code Online (Sandbox Code Playgroud)

当我从邮递员到达终点时,我收到此错误,

org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying
Run Code Online (Sandbox Code Playgroud)

我已经知道值id作为String值传递给查询.

在传递给Query之前,将Path参数类型更改为Number的最佳方法是什么?

clojure compojure compojure-api

1
推荐指数
1
解决办法
405
查看次数

Clojure:带reduce的匿名函数

我是 clojure 的新手,并在 clojure 文档中注意到了这个例子。

(reduce (fn [m [k v]] (assoc m v k)) {}{:b 2 :a 1 :c 3})

输出: ;;=> {2 :b, 1 :a, 3 :c}

有人可以解释代码背后的逻辑吗?

clojure

0
推荐指数
1
解决办法
579
查看次数

不存在类型变量 T 的实例,因此 Flux<T> 确认为 Mono<? 扩展 R)

我正在实现 Spring webflux 演示应用程序,并且已经像这样编写了我的演示应用程序

package com.abcplusd.application;

import com.abcplusd.domain.Event;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;

import java.util.Collections;
import java.util.Date;
import java.util.stream.Stream;

@SpringBootApplication
public class ReactiveClientApplication {

    @Bean WebClient webClient() {
        return WebClient.create("http://localhost:8080");
    }

    @Bean CommandLineRunner demo(WebClient webClient) {
        return args -> {
            webClient.get()
                .uri("/events")
                .accept(MediaType.TEXT_EVENT_STREAM)
                .exchange()
                .flatMap(clientResponse -> clientResponse.bodyToFlux(Event.class))
                .subscribe(System.out::println);
        };
    }
    public static void main(String[] args) {
        new SpringApplicationBuilder(ReactiveClientApplication.class)
            .properties(Collections.singletonMap("server.port", "8081"))
            .run(args);
    }
}
Run Code Online (Sandbox Code Playgroud)

它显示以下错误

Error:(29, 41) java: incompatible types: no instance(s) …
Run Code Online (Sandbox Code Playgroud)

spring-boot react-native-router-flux spring-webflux

0
推荐指数
1
解决办法
6791
查看次数