我可以使用SSR(结构搜索和替换)轻松找到我项目中某些注释的所有提及。例如,我有以下依据春天代码:在IntelliJ IDEA中查找批注
class DashboardController {
@RequestMapping("/dashboard")
public void doDashboard() {
[...]
}
}
如果我通过搜索模式org.springframework.web.bind.annotation.RequestMapping
比我会找到我的代码。但是如果我想查找使用参数化批注注释的方法,那么为“/ dashboard”url找到只有注释@RequestMapping
的方法?
我可以简单地通过@RequestMapping("/dashboard")
搜索字符串,但注释可以写在几个方面:
@RequestMapping("/dashboard")
@RequestMapping(value = "/dashboard", method = {RequestMethod.POST})
@RequestMapping(headers = "content-type=application/*", value = "/dashboard")
等
可以通过多种方式来编写此注释。例如'@RequestMapping(value =“/ dashboard”,method = {RequestMethod.POST})'等 – 2010-08-31 12:11:10
然后使用正则表达式,像'@RequestMapping(。*“/ dashboard”。*)' – 2010-08-31 12:32:44