I Have a Spring Boot Server, In my Database, I have some URLs without any special pattern, I want RequestMapping
all of these stored URLs into the Controller
and return a special view(control by template engine) for this.
I tried to do this by adding the interceptors method to my Project but I don't have any idea about returning a special view.
I read these questions:
- Dynamic Url in @Requestmapping
- spring mvc requestmapping dynamic url
- @RequestMapping controllers and dynamic URLs
- Use @RequestMapping with Dynamic URL at Controller Level
but I don't have any special pattern in the URLs of my project and there are other URLs and controllers in my project.
What can I do?
After some search, I found the solution for defining a URL and template name in the database and dynamic URL mapping without any Controller and methods.
I have the database's table by Name
Sample
:Sample:
url
template_view_name
I overriding the method
addViewControllers
ofWebApiConfigurer
to solve my problem:complete code of
WebApiConfigurer
: