Runtime loading of Controllers for Spring MVC and dynamically mapping requests/URLs

时光怂恿深爱的人放手 提交于 2019-12-05 12:10:12

For Use case A : Instead of DB you can keep the url mappings in a property file and then use property place holder to initialize beans using xml configuration on context up. This way remaining inside the spring framework, you can avoid annotations.

For Use Case B : Tomcat supports dynamic reloading of classes but that to of only non structural changes in class file. But this has memory leaks as well as it doesnt cleans up old instance of class loader rather it creates a new instance.

Jayaveera

Its quite achievable using spring-mvc-router API.

Please check below link url-action mapping & routing in Spring MVC 3.0

Here the URL can be configured to controller.method using .conf file, but this can be achievable using java configuration, and i haven't tried so far.

Also if xml configuration chosen, then check out the property 'autoReloadEnabled', but its not adviceable for production use.

Hope this helps!!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!