我发现将 JAXB 与 Guice 一起使用是可能的,但具有挑战性:这两个库都在“争夺”对象创建的控制权,您必须小心避免循环依赖,并且它可能会与所有 JAXB 适配器变得混乱和 Guice Providers
之类的东西。我的问题是:
- 你如何处理这个配置?可以应用哪些一般策略/经验法则?
- 您能给我指出一个好的教程或写得好的示例代码吗?
- 如何可视化依赖关系(包括
Adapters
和Providers
)?
I find using JAXB together with Guice possible, but challenging: Both libraries "fight" for control over object creation, you have to be careful to avoid cyclic dependencies, and it can get messy with all the JAXB Adapters
and Guice Providers
and stuff. My questions are:
- How do you deal with this configuration? What general strategies / rules of thumb can be applied?
- Can you point me to a good tutorial or well written sample code?
- How to visualize the dependencies (including the
Adapters
and Providers
)?
发布评论
评论(1)
对于一些示例代码,这里完成了一些示例工作: http://jersey.576304.n2.nabble.com/Injecting-JAXBContextProvider-Contextprovider-lt-JAXBContext-gt-with-Guice-td5183058.html
在“错误”的行?”,放入推荐行。
我看起来像这样:
For some sample code, some example work was done here: http://jersey.576304.n2.nabble.com/Injecting-JAXBContextProvider-Contextprovider-lt-JAXBContext-gt-with-Guice-td5183058.html
At the line that says "Wrong?", put in the recommended line.
I looks like this: