我正在尝试使用 Jdeps 获取 Spring Boot jar 的依赖项。我正在运行以下命令:-
jdeps --ignore-missing-deps --print-module-deps --multi-release=11 --recursive -cp BOOT-INF/lib/* x.jar
Run Code Online (Sandbox Code Playgroud)
但上述命令失败并出现以下错误:
Exception in thread "main" java.lang.Error: java.util.concurrent.ExecutionException: com.sun.tools.jdeps.MultiReleaseException
at jdk.jdeps/com.sun.tools.jdeps.DependencyFinder.waitForTasksCompleted(DependencyFinder.java:271)
at jdk.jdeps/com.sun.tools.jdeps.DependencyFinder.parse(DependencyFinder.java:133)
at jdk.jdeps/com.sun.tools.jdeps.DepsAnalyzer.transitiveArchiveDeps(DepsAnalyzer.java:217)
at jdk.jdeps/com.sun.tools.jdeps.DepsAnalyzer.run(DepsAnalyzer.java:138)
at jdk.jdeps/com.sun.tools.jdeps.ModuleExportsAnalyzer.run(ModuleExportsAnalyzer.java:74)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask$ListModuleDeps.run(JdepsTask.java:1047)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:574)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:533)
at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)
Caused by: java.util.concurrent.ExecutionException: com.sun.tools.jdeps.MultiReleaseException
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at jdk.jdeps/com.sun.tools.jdeps.DependencyFinder.waitForTasksCompleted(DependencyFinder.java:267)
... 8 more
Caused by: com.sun.tools.jdeps.MultiReleaseException
at jdk.jdeps/com.sun.tools.jdeps.VersionHelper.add(VersionHelper.java:62)
at jdk.jdeps/com.sun.tools.jdeps.ClassFileReader$JarFileReader.readClassFile(ClassFileReader.java:360)
at jdk.jdeps/com.sun.tools.jdeps.ClassFileReader$JarFileIterator.hasNext(ClassFileReader.java:402)
at jdk.jdeps/com.sun.tools.jdeps.DependencyFinder.lambda$parse$5(DependencyFinder.java:179)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832
Run Code Online (Sandbox Code Playgroud)
错误原因:-
当我运行这个 POM.xml …
我的自定义 DTO 类如下:
public class TestDto1 {
private String key;
private String val;
@AssertTrue
private boolean isValid() {
return key !=null || val !=null;
}public class TestDto1 {
private String key;
private String val;
@AssertTrue
private boolean isValid() {
return key !=null || val !=null;
}
Run Code Online (Sandbox Code Playgroud)
我的家长 DTO 课程:
public class TestDto {
private String id;
@Valid
private TestDto1 tes;
public TestDto1 getTes() {
return tes;
}
public void setTes(TestDto1 tes) {
this.tes = tes;
}
public String getId() { …Run Code Online (Sandbox Code Playgroud) Boolean我有一个看起来像这样的字段列表:
var lst = List.of(true, false, false, false);
Run Code Online (Sandbox Code Playgroud)
有一个这样的对象:
public class GetBatchStatusResponse {
String batchCompleted;
Integer totalCount;
Integer processed;
Integer pending;
}
Run Code Online (Sandbox Code Playgroud)
上面的对象当前填充有如下内容:
var resp = new GetBatchStatusResponse();
resp.setBatchCompleted(String.valueOf( !lst.contains(false));
resp.setTotalCount(lst.size());
resp.setProcessed((int)(lst.stream().filter(p ->p!=null && p == true).count()));
resp.setPending((int)(lst.stream().filter(p ->p==null || p == false).count()));
Run Code Online (Sandbox Code Playgroud)
如何在单个循环中使用流 API 实现同样的效果?
我有一个代码导致堆栈溢出问题,因为发生了不受控制的递归
public class Flaw {
Flaw() {
System.out.println("There");
}
Flaw obj = new Flaw();
public static void main(String[] args) {
new Flaw();
System.out.println("Hi");
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释为什么Flaw()构造函数不打印任何东西?