添加Spring Boot执行器的依赖关系后java.lang.instrument ASSERTION FAILED

时间:2018-10-05 19:10:45

标签: java spring-boot-actuator

我在intellij-idea中有一个Java项目。我正在使用gradle构建它。最近,我增加了对弹簧启动执行器的依赖性,从那时起,我在启动时遇到此错误:

notebook:12: error: class MyClass needs to be abstract, since: it has 2 unimplemented members. /** As seen from class MyClass, the missing signatures are as follows. * For convenience, these are usable as stub implementations. */ def _KAFKA_ID_=(x$1: String): Unit = ??? def _KAFKA_TS_=(x$1: String): Unit = ??? class MyClass{

此后,我的应用程序仍在运行,但我想摆脱此错误。

我正在尝试在Google上找到答案,但找不到任何答案。

我将不胜感激。 谢谢。

1 个答案:

答案 0 :(得分:2)

也许与您的问题没有直接关系,因为我的问题与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;

    ...
}

如果我这样使用我的实体并且正在查询例如对于ID为id的父对象,JSON实现触发了ParentChild之间的递归,但最终返回了一个值给我的测试。 为了解决这个问题,我只向父字段添加了@JsonIgnore。在这种情况下,这足以满足我的要求。

@Entity
public class Child {
    ...

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

    ...
}