请看这个 pom.xm 的片段。我们使用它来为这个特定的依赖项提取最新的工件。问题在于这种方法,它也为整个范围拉取了所有旧版本的 pom [1.1.0-100,1.2.0-999)。因为我们也使用这个范围来拉其他罐子,所以我们不想改变它。有没有办法限制 maven 不下载整个范围内的所有 poms 而不减慢构建过程?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven- 4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>rest.lib</groupId>
<artifactId>rest-lib</artifactId>
<version>${LIB.VERSION}</version>
<packaging>jar</packaging>
<name>rest-lib</name>
<description>REST specific libraries.</description>
<properties>
<JAR.VERSION>[1.1.0-100,1.2.0-999)</JAR.VERSION>
</properties>
<dependency>
<scope>provided</scope>
<groupId>com.myartifacts.rest</groupId>
<artifactId>rest-schema</artifactId>
<version>${JAR.VERSION}</version>
<type>jar</type>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud) 无法让Feign客户工作。首先尝试使用POST。保持与编码器/解码器有关的错误,指出类型不正确。然后在github上找到一个示例来最终调用简单的GET API,并决定尝试一下。仍然失败
在Github和在线上,我看到Feign Client Spring-Cloud,OpenFeign,Netflix.feign的多个版本具有不同的版本。谁能形容一个最好的,稳定的Feign客户应该用于生产什么?
package com.paa.controllers;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient (name="test-service",url="https://www.reddit.com/r")
public interface GetFeignClient {
@RequestMapping(method = RequestMethod.GET, value = "/java.json")
public String posts();
}
Controller:
@RestController
@RequestMapping("/some/api")
public class TestWLCController {
@Autowired
private GetFeignClient getFeignClient;
.. some stuff
@RequestMapping(value="/postSomething",method = RequestMethod.POST)
@ApiOperation(value = "Configures something",
notes = "basic rest controller for testing feign")
public ResponseEntity<SomeResponse> feignPost(
UriComponentsBuilder builder,
@ApiParam(name = "myRequest",
value = "request for configuring something",
required = true)
@Valid @RequestBody SomeRequest someRequest) { …Run Code Online (Sandbox Code Playgroud) 看到这段代码:(这是工作代码,但我不喜欢使用2行,所以寻找如何让它变得更好)
ItemDetails[] items = response.getDetailsList();
items = Arrays.stream(items).filter(x -> !x.getName().equalsIgnoreCase("acl1")).toArray(ItemDetails[]::new);
items = Arrays.stream(items).filter(x -> !x.getName().equalsIgnoreCase("acl2")).toArray(ItemDetails[]::new);
Run Code Online (Sandbox Code Playgroud)
我无法想象如何使用一个OR (|)条件filter来删除两个特定元素,List因为它会给我编译时错误(在IDE中),我最终使用两个filters像上面那样.我能错过什么?
这就是我尝试使用OR的方式
items = Arrays.stream(items).filter(x -> !x.getName().equalsIgnoreCase("acl1") ||
x -> !x.getName().equalsIgnoreCase("acl2")).toArray(ItemDetails[]::new);
Run Code Online (Sandbox Code Playgroud)
=> IntelliJ会抱怨这个(上面)
items = Arrays.stream(items).filter(x -> !x.getName().equalsIgnoreCase("acl1"") ||
x.getName().equalsIgnoreCase("acl2")).toArray(ItemDetails[]::new);
Run Code Online (Sandbox Code Playgroud)
在运行时不起作用(它不会过滤)
带注释代码的整个代码(我试过)供参考
public static void mapTest () {
AclDetailItem[] items = new AclDetailItem[3];
AclDetailItem item1 = new AclDetailItem();
item1.setAclName("acl1");
AclDetailItem item2 = new AclDetailItem();
item2.setAclName("acl2");
AclDetailItem item3 = new AclDetailItem();
item3.setAclName("acl3");
items[0] = item1;
items[1] = …Run Code Online (Sandbox Code Playgroud) 我需要安装 NFS。经过多次尝试和错误,我可以在 Linux 系统上从 NAS 挂载 NFS 文件系统。我们还评估了当 NFS 不工作时是否可以使用 cif。手册页太混乱了,在网上找不到任何清晰的解释。我的问题是 - 如果 NFS 出现问题,可以使用 mount -t cifs 吗?cifs 是否始终可以替代 nfs。
curl -k -XPOST 'https://localhost:9200/myweb/myrep/**input_string**/_update' -d '{"doc":{"status":"Disconnected"}}'
Run Code Online (Sandbox Code Playgroud)
在上面调用以获取 XML文件中的input_string列表
选项1:编写一个bash脚本以完成上述任务,然后从Java代码中调用此脚本
选项2:RunTime.exec()在这样的for循环中调用curl命令:java中的curl命令
还有其他更好的方法吗?
这将是我执行各种其他事情的整个Java程序中的重要步骤之一。这就是我在寻找将其与Java代码很好地集成的方法的原因,而不是提供作为单独的CLI脚本在上面运行的选项。