in order to implement modular approach (simillar to oSGI) i am using spring plugin framework (https://github.com/spring-projects/spring-plugin), i have provided a specific interface as an extension point which my plugin implementations will implement
two things needs to be done first: scanning all classes in classpath and fetching implementations which implement that interface(extension-point)
second: adding those implementation beans to application context
first part m able to achieve as spring plugin provides PluginRegistry which looks up all the implementation for a given plugin type
registry.getPluginFor(ProductType.SOFTWARE);
// Returns the first plugin supporting SOFTWARE, or DefaultPlugin if none found
registry.getPluginFor(ProductType.SOFTWARE, new DefaultPlugin());
// Returns all plugins supporting HARDWARE, throwing the given exception if none found
registry.getPluginsFor(ProductType.HARDWARE, new MyException("Damn!");
second part: how should i register this list of beans to application context now, without causing any conflicts
might wanna look at this, It’s probably a better idea to provide a specific interface for your extension points, and then allow plugins to implement them. In this article, I’ll describe a way to achieve this with Annotations and Spring
https://devnotesblog.wordpress.com/2011/03/20/adding-plug-ins-to-your-application-with-spring/