I would like to introduce caching into an existing Spring project which uses JAXB to expose WebServices. Caching will be done on the level of end points. In order to do that classes generated from XSD using JAXB need to implement Serializable interface and override Object‘s toString() method.
How to instruct the xjc tool using XSD to generate source with needed properties?
Serializable
Use
xjc:serializablein a custom bindings file to add thejava.io.Serializableinterface to your classes along with aserialVersionUID:toString()
Use a superclass (see
xjc:superClass) from which all your bound classes will inherit. This class won’t be generated by xjc so you are free to create it as you please (here with atoString()implementation):