简体   繁体   English

使用大写字母 server.servlet.contextPath 值点击 URL 时未加载字符串引导应用程序

[英]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:笔记:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring 执行器即使在设置 server.servlet.contextPath 后也给出 404 Not found 错误 - Spring actuator giving 404 Not found error even after setting server.servlet.contextPath 搜索字符串中的大写字母 - Search for Capital Letter in String Spring Boot-忽略属性server.contextPath - Spring Boot - ignore property server.contextPath 带有嵌入式 Tomcat 的 Spring Boot 应用程序在请求 /contextPath 时不重定向到 https 而不使用尾部斜杠 - Spring Boot application with embedded Tomcat behind reverse proxy not redirecting to https when asking for /contextPath without trailing slash 当 jsp 调用 servelt 时,上下文路径未在 url 中设置 - contextpath is not setting in url when jsp to servelt is calling 使用字符串模板将第一封信转换为大写 - Convert First Letter to Capital using String Template 在java中使String首字母大写 - Make String first letter capital in java 我可以使用哪个Java Regex来匹配查询字符串前面有大写字母的URL? - Which Java Regex can I use to match a URL that has a capital letter before the query string? 计算字符串中以大写字母开头的所有单词 - Count all words in a string that start with a capital letter 字符串中最常见的字母(大写和小写) - Most common letter ( Capital and small) in a string
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM