运行springboot项目出现:Type javax.xml.bind.JAXBContext not present

问题:运行springboot项目出现:Type javax.xml.bind.JAXBContext not present

原因

java9+版本以后,JAXB默认没有加载

 

手动添加模块到pom:

    spring boot 2.0.*版本,添加如下代码:

————————————————

<!-- jaxb模块引用 - start -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<!-- jaxb模块引用 - end -->
————————————————

转自:https://blog.csdn.net/alger_magic/article/details/83041811

 

posted on 2020-01-27 20:39  jav-a-  阅读(649)  评论(0编辑  收藏  举报