简体   繁体   中英

Spring Boot - ignore property server.contextPath

In my spring application.properties I've got property

server.contextPath=/my/context/path

But I need to setup controller that will handle this path:

http:/localhost:8888/

Is there any way to ignore server.contextPath property only in one controller?

Thanks

No.

While using one DispatcherServlet you could remove the server.contextPath property and annotate all your controllers (but one) with @RequestMapping("/my/context/path")

Another options is to work with two DispatcherServlet s. One mapped to /* containing the one controller and a second one mapped to /my/context/path/* containing all the other controllers.

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