The CXF JAXRS extension allowing users to describe how their services have to be handled by the JAX-RS runtime without annotating them has already been mentioned in this entry.
It has been improved since then, it is now possible to describe interfaces with the runtime being able to apply the model information to the objects injected from Spring or registered from OSGI BundleActivators. Here is the updated documentation, and here is the short info on the DOSGi demo showing this feature in action.
Now, when I mentioned this feature for the first time, I implied that for the (CXF JAXRS) JAXB provider to continue working JAXB annotations still had to be there. The JAXB provider has been enhanced quite a bit recently but one of the enhancements which is worth mentioning here is that one can now tell it to marshal and unmarshal Java beans without them being annotated with annotations like @XmlRootElement or introducing JAXBElements in their method signatures. One can simply set a 'marshalAsJaxbElement' property on the JAXB provider and it will wrap all the objects as needed. It is also possible to be more selective about which objects will be wrapped under the hood. For more information see here and here.
So yes, it is possible after all : have a production code working without annotations.
Friday, August 28, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment