简体   繁体   English

`{param:。+}`中的“:。+”是什么意思(java)?

[英]What does “:.+” in `{param:.+}` means (java)?

What does the :.+ at {param:.+} mean in this set of code in java? 什么:.+ at {param:.+}在java的这组代码中是什么意思? I have tried searching however i do not find any explanation. 我试过搜索但是我找不到任何解释。 Someone who knows please do explain it to me. 知道的人请向我解释一下。 Thank you so much. 非常感谢。

BatchFileController.java BatchFileController.java

@RequestMapping("/runbatchfileparam/{param:.+}")  
public ResultFormat runbatchFile(@PathVariable("param") String fileName) 
{  
RunBatchFile rbf = new RunBatchFile();  
return rbf.runBatch(fileName);  
}  

The colon : is separator between the variable name and a regular expression. 冒号:是变量名和正则表达式之间的分隔符。

The expression .+ means at least one of any character. 表达式.+表示任何字符中的至少一个。

This is used if in case your path variable has . 如果路径变量有,则使用此方法. in them. 在他们中。 For example, if you want to pass a inner field in mongo as a path variable to fetch from database. 例如,如果要将mongo中的内部字段作为路径变量传递给从数据库中获取。 (student.address.id). (student.address.id)。 By default everathing after the first dot is ignored. 默认情况下,忽略第一个点后的everathing。 To tell spring framework not to truncate :.+ is used. 告诉spring框架不要截断:.+使用。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM