简体   繁体   中英

Ignore context-path for specific endpoint in Spring boot

I have setup the property server.servlet.context-path=/xyz in the application.properties file so all my endpoint have a prefix of /xyz. Now, I want to create an endpoint that should not have /xyz as the prefix(as an exceptional scenario). How can I achieve that?

Technically it is not possible because spring boot has only one DispatcherServlet which is a front controller, if you want two different paths then you can use @RequestMapping annotation on two different controllers`

Still of you want two different context-paths then you should have two DispatcherServlet's

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM