Solve the version inconsistency problem when renren-fast integrates spring cloud alibaba nacos

When using renren-fast, you need to register it with nacos and route it through the gateway. However, there was a springboot version incompatibility problem during integration. Among them, renren-fast uses springboot2.6.6 version. When I developed, I used version 2.3.7.RELEASE. There is a version conflict when importing my own common module into the renren-fast project.

Solution:
1. Use the new version of nacos and do not import common dependencies.
2. Lower the version of springboot of renren-fast.

Upgrading and downgrading versions requires changing dependencies. However, I encountered the problem of not being able to clear Maven dependencies. For detailed solutions, you can read this article.

Theoretically speaking, renren-fast is less coupled with this project in the future. It is relatively more reasonable to choose solution 1 to let it use a higher version of nacos. Because this module was not developed by myself, I don’t know how different versions of springboot are. It’s also unclear whether they used a large number of new APIs when developing renren-fast, and rashly downgrading the version may cause many problems. (After all, versions are generally backward compatible).

However, when I tried to use the 2021.1 version of nacos, I found that they did not support the 2.6.6 version of springboot. There was no way, so I had to downgrade the version.

First try to downgrade the version to 2.3.7.RELEASE. If it can be seamlessly connected, that would be ideal.

Compilation found that there is an error

Please add image description
The solutions at this time are:
1. Upgrade to a higher version supported by springcloud alibaba
2. Fix the bug

Because there is only one bug, and it is a "java cannot find symbol" bug, which probably means that there is no such method in this package. It can be speculated that the old version of springboot did not have this API, and it was probably added in the new version. or modified. A closer look revealed that (allowedOriginPatterns) is a solution to cross-domain problems. It should just change the name and implementation. Similar APIs should also be found in older versions. (allowedOrigins)
Please add image description
Please add image description
replacement, solution. Can run successfully.

Guess you like

Origin blog.csdn.net/weixin_45654405/article/details/124415624