启动 Spring Boot 应用程序时显示 JAXB 警告

Mat*_*nan 6 java spring-boot

启动 Spring Boot 应用程序时显示 JAXB 警告

WARN 854325 --- [nio-5558-exec-1] com.amazonaws.util.Base64                : JAXB is unavailable. Will fallback to SDK implementation which may be less performant.If you are using Java 9+, you will need to include javax.xml.bind:jaxb-api as a dependency.
Run Code Online (Sandbox Code Playgroud)

我应该如何解决这个问题?

ams*_*ger 6

在 Java 9(引入了模块的概念)中,删除了多个依赖项,其中包括javax.*一个(请参阅JEP 320)。从这个版本开始,您需要手动添加它们。

对于您的情况,您需要添加jaxb-api

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

Run Code Online (Sandbox Code Playgroud)

另外,您可能需要添加它的实现(如果您还没有):

<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
    <version>3.0.0</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>3.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)