我写了一个spring boot微服务和一个REST客户端.客户端是另一个模块的一部分,并对微服务进行RESTful调用.微服务向Eureka注册表注册,我希望我的客户端(这不是一个Spring引导项目)使用Eureka来查询和获取服务端点.
我的问题是因为客户端不是Spring-Boot应用程序我不能使用类似的注释@SpringBootApplication
,@EnableDiscoveryClient
并且DiscoveryClient
不会自动连接到应用程序.反正有DiscoveryClient
没有使用注释手动将bean 自动连接到客户端?
以下示例取自 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) 我是新来的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)
我很确定他们以合理的理由设计它,请让我理解它.
Postman 被用作 API 测试的流行测试工具,您可以使用 Postman 编写大量单元测试并将它们作为构建过程的一部分执行以执行单元测试。下面介绍了 Postman 测试的 Jenkins 集成。
为了做到这一点,你应该有