I have a jar with the model DTOs.
I want these classes (marked with @XmlRootElement
) to be available to Jersey 1 HTTP client. My initialization code is:
ClientConfig cc = new DefaultClientConfig(MyContextResolver.class);
Client client = Client.create(cc);
In MyContextResolver
(which implements ContextResolver<JAXBContext>
), I've tried:
jaxbContext = JAXBContext.newInstance(Class1.class, Class2.class);
It works, but it's not dynamic (I have to add classes manually, one by one).
I also used Spring and it worked, but I want a Spring free solution.
Is there a better solution? One that automatically scans all classes in the jar and adds them to the context? Thanks.