Ask Your Question
2

Can one use 2 base request paths and how can Spring be informed about which one to use when making a request?

asked 2022-01-25 11:00:00 +0000

nofretete gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-03-23 03:00:00 +0000

lalupa gravatar image

Yes, it is possible to use multiple base request paths in Spring. One way to inform Spring about which one to use when making a request is by using RequestMappingHandlerMapping's setBaseUrl method. This method allows you to set a base URL for the request mappings defined in your application. When a request is made, Spring will use the specified base URL to determine which controller and method to route the request to. Alternatively, you can create separate controller classes for each base URL and annotate them with @RequestMapping to define the paths for each specific controller.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-01-25 11:00:00 +0000

Seen: 11 times

Last updated: Mar 23 '22