Does XSD have good practice when passing XML marshalled objects over wiring?

I am using a JAXB, JPA, and RESTful web service connection to transfer objects by cable. My domain objects contain a combination of JPA and JAXB annotations, and I can successfully decouple my domain objects using Spring RestTemplate with a minimal amount of code. I remember that I read something not so long ago (maybe it was an answer to SO, maybe it was a blog), where the author claimed that he would never rely on annotations in the production environment, but always marshalls and cancels according to the scheme. Is this still a necessary practice?

If I have a .jar with annotated beans, which is a dependency in two projects (for example, the RESTful web service and the consumer), would the deployed XSD implement effectively add another dataset requiring maintenance? When using annotated POJO JAXBs, when are schemas required, and what benefits do they provide?

+3
source share
3 answers

JAXB presents its metadata as annotations, so there is actually no marshal / non-marshal according to the XML schema.

I lead the JAXB ( MOXy ) component of EclipseLink , which is best known for the JPA implementation . My recommendation for developers is to use a combination of JAXB and JPA annotations on their model.

XML:

  • biziclop JAXB XML- / .
  • XML RESTful, , XML-. , , .
+1

dev (, ), . , , - , XSD .

+1

Java, , . , -Java-, XSD (, , ) .

+1

Source: https://habr.com/ru/post/1787695/


All Articles