[英]Exception to Context Path in Spring Boot Application
I am building a Spring Boot and Thymeleaf application with the custom context path:我正在使用自定义上下文路径构建 Spring Boot 和 Thymeleaf 应用程序:
server.servlet.context-path=/myapp
So the application can be accessed as:因此可以访问该应用程序:
http://localhost:8080/myapp
All content is served on the /myapp
context path, except for one mapping for a special case which needs to be:所有内容都在/myapp
上下文路径上提供,但特殊情况下的一个映射除外,它需要:
http://localhost:8080/exception
Is there a way to make an exception to the custom context path for this special case?有没有办法为这种特殊情况对自定义上下文路径进行例外处理?
No, Context-path is globally for the whole application, but still, there are two ways to archive what you want-不,上下文路径是整个应用程序的全局路径,但是仍然有两种方法可以归档您想要的内容-
I personally won't prefer any of the above solutions as the first one is not suitable for a large application and the second solution adds extra complexity.我个人不会喜欢上述任何解决方案,因为第一个不适合大型应用程序,而第二个解决方案增加了额外的复杂性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.