[英]String Boot application is not loading when hitting URL with capital letter server.servlet.contextPath value
I am working on a Spring Boot Application.我正在开发 Spring 引导应用程序。
application.properties应用程序属性
server.servlet.contextPath=myapp
When I am hitting a base URL as below:当我遇到如下基础 URL 时:
http://localhost:8080/myapp
, I can see my application is loading http://localhost:8080/myapp
,我可以看到我的应用程序正在加载
http://localhost:8080/MYAPP
, I am getting HTTP Status 404. http://localhost:8080/MYAPP
,我得到 HTTP 状态 404。
Not sure why this is happening, can anyone please explain this to me?不知道为什么会这样,谁能给我解释一下?
For your question in the comment: is there any way I can make context path case insensitive?
对于您在评论中的问题:
is there any way I can make context path case insensitive?
Overriding the configurePathMatch
would work覆盖
configurePathMatch
将起作用
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
AntPathMatcher pathMatcher = new AntPathMatcher();
pathMatcher.setCaseSensitive(false);
configurer.setPathMatcher(pathMatcher);
}
}
Note:笔记:
Deprecated
.Deprecated
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.