Hi all,
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.Code:<context:component-scan base-package="org.chakra" > //core controllers <context:include-filter type="regex" expression="org.site.core.controller.*"/> //hot plugged plugins <context:include-filter type="regex" expression="org.site.apps.*.controller.*"/> </context:component-scan>
This is the result of my recent experiments for add to the context new Controller:
Nothing seems to work.Code://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); scanner.scan("org.site.apps.MyFirstApp.controller"); ((XmlWebApplicationContext) webAppContext).refresh();
I would be very grateful for any help.
Thanks,
Gabriele


Reply With Quote
