是否可以在运行时动态地向Servlet添加URL模式?例如,当Servlet启动时,扫描文件夹中的注释,然后将这些url模式注入到servlet中?
在Servlet的init文件中,我想这样做(伪代码)
// scan all the files in the package my.project.services
// find all the classes with the Annotation @Service
// read those annotations, find the url patterns in them, and insert them into the servlet
Run Code Online (Sandbox Code Playgroud)