【问题标题】:Spring Boot Test - Error creating bean with name SpringBootRepositoryRestMvcConfigurationSpring Boot 测试 - 创建名称为 SpringBootRepositoryRestMvcConfiguration 的 bean 时出错
【发布时间】:2020-01-24 19:44:07
【问题描述】:

我正在尝试运行此项目 test 类 (SurveyControllerIT),但在下面出现此错误。我已经尝试了一些事情但没有成功。

org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为“org.springframework.boot.autoconfigure.data.rest.SpringBootRepositoryRestMvcConfiguration”的bean时出错:通过构造函数参数0表示的依赖关系不满足:创建名为“spring. data.rest-org.springframework.boot.autoconfigure.data.rest.RepositoryRestProperties':bean初始化失败;嵌套异常是 java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException;嵌套异常是 org.springframework.beans.factory.BeanCreationException:创建名为“spring.data.rest-org.springframework.boot.autoconfigure.data.rest.RepositoryRestProperties”的 bean 时出错:bean 初始化失败;嵌套异常是 java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException

源码:source

【问题讨论】:

    标签: java spring spring-boot junit


    【解决方案1】:

    您缺少一个依赖项。尝试将此添加到您的 pom 中(如果您使用的是 maven):

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
    </dependency>
    

    您可能还必须提供一个版本,但我认为它可能是从 Spring Boot 父级继承的。

    【讨论】:

      猜你喜欢
      • 2020-07-27
      • 2019-04-27
      • 2023-02-09
      • 2017-04-17
      • 2019-02-12
      • 2020-06-05
      • 1970-01-01
      • 1970-01-01
      • 2019-02-27
      相关资源
      最近更新 更多