Java – spring adds an external spring context at runtime

We have a home page with multiple components (widgets), which is a bit like a portal with portlets Some of these widgets will be provided by other teams, and some of them will require some custom beans managed by spring One solution might be to import the spring context using an import statement with an I wildcard (for example, import all contexts in the classpath matching context widget – *. XML)

However, I prefer a more programmatic solution in which I check the context (from the classpath) that each widget needs to load I didn't find any blog to explain this problem, but I did find some posts on the forum, indicating that this will be a father son context, which is only one-way; Unfortunately, in my case, it needs to be two-way

Therefore, after browsing some APIs, I try to propose some effective methods, but I don't believe it is a good solution or it has any traps I didn't think of Perhaps there is another (better) solution to this situation?

Solution

This is actually what I do We have used this method for more than three years and have never had a problem

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>