Skip to content

Commit 130ef10

Browse files
committed
Merge pull request #16005 from larsgrefer
* pr/16005: Polish "Update instructions on how to use JAXB as XML renderer" Update instructions on how to use JAXB as XML renderer
2 parents 5332669 + c47edd1 commit 130ef10

File tree

1 file changed

+15
-4
lines changed
  • spring-boot-project/spring-boot-docs/src/main/asciidoc

1 file changed

+15
-4
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,9 +1166,9 @@ work. To use the Jackson XML renderer, add the following dependency to your proj
11661166
</dependency>
11671167
----
11681168

1169-
If Jackson's XML extension is not available, JAXB (provided by default in the JDK) is
1170-
used, with the additional requirement of having `MyThing` annotated as
1171-
`@XmlRootElement`, as shown in the following example:
1169+
If Jackson's XML extension is not available and JAXB is available, XML can be rendered
1170+
with the additional requirement of having `MyThing` annotated as `@XmlRootElement`, as
1171+
shown in the following example:
11721172

11731173
[source,java,indent=0,subs="verbatim,quotes,attributes"]
11741174
----
@@ -1179,7 +1179,18 @@ used, with the additional requirement of having `MyThing` annotated as
11791179
}
11801180
----
11811181

1182-
To get the server to render XML instead of JSON, you might have to send an
1182+
JAXB is only available out of the box with Java 8. If you're using a more recent java
1183+
generation, add the following dependency to your project:
1184+
1185+
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
1186+
----
1187+
<dependency>
1188+
<groupId>org.glassfish.jaxb</groupId>
1189+
<artifactId>jaxb-runtime</artifactId>
1190+
</dependency>
1191+
----
1192+
1193+
NOTE: To get the server to render XML instead of JSON, you might have to send an
11831194
`Accept: text/xml` header (or use a browser).
11841195

11851196

0 commit comments

Comments
 (0)