On 23/03/16 15:04, Vjacheslav V. Borisov wrote:
2016-03-23 15:48 GMT+04:00 Sergey Beryozkin <[email protected]>:

Thanks for the analysis and the patch, I'm traveling so will look into it
in detail next week (though might apply the patch earlier), does your patch
addresses all of your concerns you raised in this thread ?


Yes, counting that for first I found suitable workaround.

I applied your patch, thanks.

When you have both JAXB and JSON providers explicitly configured, using a schema holder is the most optimal approach, the schema is loaded once, and is shared between the two providers.

The JAX-RS runtime must support JAXB OOB, i.e, users should not be forced to register JAXB providers for JAXB to be supported, hence when you start the server JAXBElementProvider with the default settings is loaded. JSONProvider is only loaded if Jettison is on the classpath.

So you start the server and you have at least JAXBElementProvider and other required providers already loaded.

What you configure in Spring are different instances, these are user-registered providers which are often preferred to the default providers, as in the case of JAXB/etc.

I'm not sure what happens when you use @SchemaValidation and no schema holder. Can you please put a breakpoint in AbstractJaxbProvider.init() and see how SchemaValidation is processed. I can imagine that a schema will be loaded 4 times in this case - twice for default providers and twice for the same providers loaded from Spring

but also, as I mentioned it is really better to use a schema holder in this case - only user registered providers will be set-up with a shared schema reference.



Cheers, Sergey

Reply via email to