feign icon indicating copy to clipboard operation
feign copied to clipboard

OpenFeign - jaxb - jaxb context preload extremely slow

Open ApostolisKATALAGARGIANOS opened this issue 3 years ago • 0 comments

I am experiencing considerable latency using feign-soap (or feign-jaxb) when:

  • Preloading jaxb context with a list of jaxb classes (1 minute or more):
new JAXBContextFactory.Builder()
          .withMarshallerJAXBEncoding(StandardCharsets.UTF_8.toString())
          .withMarshallerFormattedOutput(true)
          .build(classes);
  • Creating a marshaller/unmarshaller for a previously unloaded class (10-15 seconds):
jaxbContextFactory.createMarshaller(clazz)

The above times exceed by far the time taken to preload the jaxb context using spring-oxm (approximately 10 seconds to preload all classes):

    final Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath(clientContextPath);
    return marshaller;

Finally, as an enhancement, I think that it would be helpful to add the ability to preload jaxb context using context path (like in spring-oxm) rather than having to use reflection in order to find all jaxb classes under a specific package.