When I try use a 'javax.xml.bind.annotation' based class from a @org.springframework.web.bind.annotation.RestController, I don't see the value in the name attribute showing up in the response. I am using both @org.springframework.web.bind.annotation.RequestBody and @org.springframework.web.bind.annotation.ResponseBody in my RestController.
E.g., a class Foo has an annotation of @javax.xml.bind.annotation.XmlRootElement(name="foo").
What I get back is <Foo> and not <foo>. The latter is what I am trying to achieve.
Can someone please help me ?
TIA.
If you had no luck yet, try using Jackson XML annotations instead of JAXB's ones:
You should have this annotation available as it is packaged on
jackson-dataformat-xmldependency which you stated already had included in your project.If you prefer to use JAXB annotations, you should configure
spring-mvcto useorg.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverteras XML message converter instead of Jackson's one.