简体   繁体   English

两个版本的弹簧在同一个应用程序中

[英]Two versions of spring in the same application

What I'm trying to do is very similar to this , I just wanted to know if the answer is up to date since this problem was answered 4 years ago. 我正在尝试做的与非常相似,我只是想知道答案是否是最新的,因为4年前这个问题得到解答。

So, I have 2 maven project let's say A and B, project A depends on Spring 3 project B depends on Spring 5, I want to add some project B functionalities to project A so I have added B as a dependency to project A, the problem is that now project A have 2 conflicting spring versions spring 3 and 5 and I can't use spring 5 since it's not backward-compatible. 所以,我有2个maven项目让我们说A和B,项目A依赖于Spring 3项目B依赖于Spring 5,我想在项目A中添加一些项目B功能,所以我添加了B作为项目A的依赖项,问题是,现在项目A有2个冲突的弹簧版本弹簧3和5,我不能使用弹簧5,因为它不向后兼容。

I'm using maven for dependency management, I don't know if the solution provided in this post is working I haven't tried it yet (it seems to be a long procedure) I want the easiest way to do it; 我正在使用maven进行依赖管理,我不知道这篇文章中提供的解决方案是否正常工作我还没有尝试过(这似乎是一个很长的过程)我想要最简单的方法来做到这一点;

please help. 请帮忙。

This has not changed. 这没有改变。 You cannot have multiple versions of the same class in one classloader. 您不能在一个类加载器中拥有同一类的多个版本。 So you still would need classloader isolation to get this to work. 所以你仍然需要classloader隔离才能使它工作。

A (more or less) new solution would be to separate your application parts into micro services and call each other using some wire protocol like REST. 一个(或多或少)新解决方案是将您的应用程序部分分离为微服务,并使用一些有线协议(如REST)相互调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM