小编Upu*_*era的帖子

没有Spring-boot的Eureka服务发现

我写了一个spring boot微服务和一个REST客户端.客户端是另一个模块的一部分,并对微服务进行RESTful调用.微服务向Eureka注册表注册,我希望我的客户端(这不是一个Spring引导项目)使用Eureka来查询和获取服务端点.

我的问题是因为客户端不是Spring-Boot应用程序我不能使用类似的注释@SpringBootApplication,@EnableDiscoveryClient并且DiscoveryClient不会自动连接到应用程序.反正有DiscoveryClient没有使用注释手动将bean 自动连接到客户端?

java spring spring-boot microservices netflix-eureka

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

字符串排列的时间复杂度

以下示例取自 Cracking the coding interview (version 6) book。根据本书,以下代码的时间复杂度为 O(n^2 * n!)。(请参考例子12.第32,33页)

public static void main(String[] args) {
    new PermutationsTest().permutations("ABCD");
}

void permutations(String string) {
    permutations(string, "");
}

static int methodCallCount = 0;

void permutations(String string, String perfix) {


    if (string.length() == 0) {
        System.out.println(perfix);
    } else {
        for (int i = 0; i < string.length(); i++) {
            String rem = string.substring(0, i) + string.substring(i + 1);
            permutations(rem, perfix + string.charAt(i));
        }
    }

    System.out.format("Method call count %s \n", methodCallCount);
    methodCallCount += …
Run Code Online (Sandbox Code Playgroud)

algorithm big-o time-complexity

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

为什么java 8中没有原始的BiConsumer?

我是新来的Java 8,我无法找到任何原始BiConsumer(IntBiConsumer等),但是有一个ToIntBiFunction这是双功能的原始专业化.还有一个IntBinaryOperator与ToIntBiFunction相同.

BiConsumer<Integer,String> wrappedBiConsumer = (i,s) -> System.out.printf("Consume %d %s \n",i,s);
ToIntBiFunction<String,String> toIntFunction = (a,b) -> a.length()* b.length();
Run Code Online (Sandbox Code Playgroud)
  1. 有没有理由为什么Oracle没有提供带有Java8的IntBiConsumer?
  2. 为什么有两个接口,如"IntBinaryOperator"和"ToIntBiFunction",而不是像"IntBiFunction"这样的接口?(如果它们用于不同的目的,它们仍然可以从同一个父IntBiFunction扩展)

我很确定他们以合理的理由设计它,请让我理解它.

java functional-programming java-8

3
推荐指数
2
解决办法
467
查看次数

如何为邮递员测试设置 Jenkins 管道

Postman 被用作 API 测试的流行测试工具,您可以使用 Postman 编写大量单元测试并将它们作为构建过程的一部分执行以执行单元测试。下面介绍了 Postman 测试的 Jenkins 集成。

为了做到这一点,你应该有

  1. 将 Postman 测试导出为集合
  2. 在执行测试时使 API 在运行时可用。(使用 docker 或通过创建单独的构建管道。)

jenkins postman

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