Java 在Spring Boot中更改XML文件的映射

Java 在Spring Boot中更改XML文件的映射,java,spring-boot,url-routing,Java,Spring Boot,Url Routing,我想动态地提供我的sitemap.xml,但是每个.xml文件都映射到我的Spring Boot应用程序中的静态内容 @RequestMapping(value = "/sitemap.xml", produces = MediaType.TEXT_XML_VALUE, method = RequestMethod.GET) public @ResponseBody String xmlSitemap() { HashSet<String> uris = new HashSe

我想动态地提供我的
sitemap.xml
,但是每个
.xml
文件都映射到我的Spring Boot应用程序中的静态内容

@RequestMapping(value = "/sitemap.xml", produces = MediaType.TEXT_XML_VALUE, method = RequestMethod.GET)
public @ResponseBody String xmlSitemap() {
    HashSet<String> uris = new HashSet<>();
    // add Strings
    return SitemapCreator.createSitemapFromRelativeLinks(uris,"https://domain.tld");
}
@RequestMapping(value=“/sitemap.xml”,products=MediaType.TEXT\u xml\u value,method=RequestMethod.GET)
public@ResponseBody字符串xmlSitemap(){
HashSet uris=新的HashSet();
//添加字符串
返回SitemapCreator.CreateSiteMapFromRelativeLink(URI)https://domain.tld");
}
每次我打开
http://localhost:8080/sitemap.xml
它抛出一个404。如果将
RequestMapping
的值更改为“/sitemap”,则它可以工作