Spring.Rest和Common.Logging 3.0兼容性问题

时间:2015-03-03 19:23:35

标签: c# .net spring

我很深入地狱,并在这里求助于一个开放式问题。我在我的Web应用程序中使用springframework.net端口,并且最近已升级到预发布版本2.0。除了commons.logging的新依赖之外,一切都正常工作。

经过大量的谷歌搜索后,我发现以前的common.logging 2.0和最新的3.0不兼容,但有一个变通方法,以common.logging.core 3.0的形式。实施后,一切正常。

但是现在我不得不升级Spring.Social.Twitter和Spring.Social.LinkedIn,它们都依赖于Spring.Rest(1.1.1.35040)。 Spring.Rest库仍然依赖于common.logging 2.0。

我认为通过简单地将绑定重定向滑入我的web.config一切都会很好,但事实并非如此。在运行时从Spring.Rest.RestTemplate类访问任何内容时,它失败并显示“找不到方法:'Common.Logging.ILog Common.Logging.LogManager.GetLogger(System.Type)'。”

罪魁祸首在RestTemplate里面

private static readonly Common.Logging.ILog LOG = Common.Logging.LogManager.GetLogger(typeof(RestTemplate));

这是我的绑定重定向

<dependentAssembly>
    <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>

我已经尝试了我能想到的每一个解决方案来解决这个问题,但我迷失了,迫切需要修复。任何帮助都会非常感激。

1 个答案:

答案 0 :(得分:0)

试图解决同样的问题,但遗憾的是没办法。

问题是,使用Common.Logging 3.0 ILogger接口从Common.Logging移动到Common.Logging.Core,因此二进制文件找不到它。如果你进行相反的重定向,那么另一个二进制文件将面临这个问题。

换句话说,唯一的方法是将两个库编译为相同版本的Common.Logging,因为它们彼此不兼容。

编译针对Common.Logging的Spring.Rest实际上并不困难(你必须只更新Common.Logging并添加Common.Logging.Core)但首先它将是无符号的,其次我对Spring是否有点惊讶.Rest仍然保持 - 最后一个版本大约4年,这真是太可惜了,因为至少Java版本非常酷......

相关问题