java.lang.instrument ASSERTION FAILED 在为 spring boot 执行器添加依赖项后失败

Dru*_*dik 6 java spring-boot-actuator

我在intellij-idea中有一个java项目。我正在使用 gradle 来构建它。最近我添加了对 Spring Boot 执行器的依赖,从那以后我在启动时遇到这个错误:

*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at JPLISAgent.c line: 844

在那之后我的应用程序仍在运行,但我想摆脱这个错误。

我试图在谷歌上找到答案,但我找不到任何答案。

我将不胜感激任何帮助。谢谢你。

mor*_*ore 10

也许与您的问题没有直接关系,因为我的与 无关Spring Boot Actuator,但也许它可能会帮助其他人。

我在测试 REST 控制器时出现了问题。我不提供 DTO,而是直接返回我的实体。我One-To-ManyParent和之间也有双向关系Child。将GET正在生产application/jsonMediaType

@Entity
public class Parent {
    ...

    @OneToMany(mappedBy = "parent")
    private Set<Child> children;

    ...
}

@Entity
public class Child {
    ...

    @ManyToOne
    @JoinColumn(name = "PARENT_ID", referencedColumnName = "ID")
    private Parent parent;

    ...
}
Run Code Online (Sandbox Code Playgroud)

如果我像这样使用我的实体并通过 id 查询例如父级,则 JSON 实现会触发Parent和之间的递归Child,但最终返回一个值给我的测试。为了解决这个问题,我只是@JsonIgnore在父字段中添加了一个。在这种情况下,这足以满足我的要求。

@Entity
public class Child {
    ...

    @ManyToOne
    @JoinColumn(name = "PARENT_ID", referencedColumnName = "ID")
    @JsonIgnore
    private Parent parent;

    ...
}
Run Code Online (Sandbox Code Playgroud)