I try to solve my problem for weeks but still i did not succeed. I am here to seek help.
I would like to have a plugins architecture.
Loading at runtime "controller" class (uploading a zip file) I would make Spring rescan the context in search of the "@RequestMapping" annotations .
In my x-servlet.xml i've:
I use a custom classloader to "addCustomRepositoryOrLocation" the new package to classpath and it works.
<context:component-scan base-package="org.chakra" >
<context:include-filter type="regex" expression="org.site.core.controller.*"/>
//hot plugged plugins
<context:include-filter type="regex" expression="org.site.apps.*.controller.*"/>
This is the result of my recent experiments for add to the context new Controller:
Nothing seems to work.
//I recover webAppContext and applicationContext from my CustomContextListener
//MyContextListener extends ContextLoaderListener implements ServletContextListener
AutowireCapableBeanFactory factory = ((XmlWebApplicationContext) webAppContext).getAutowireCapableBeanFactory();
//AutowireCapableBeanFactory factory = applicationContext.getAutowireCapableBeanFactory();
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) factory;
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(registry);
I would be very grateful for any help.