简体   繁体   English

spring-boot中@P注解的含义

[英]meaning of @P annotation in spring-boot

I have a simple and maybe stupid question so apologies in advance..我有一个简单的,也许是愚蠢的问题,所以提前道歉..

I have been reading some spring-boot java code recently I am able to understand almost all for I have been able to find documentation everywhere.. but for example for this I still can't figure out the exact meaning (I am not able to find the annotation @P ):我最近一直在阅读一些 spring-boot java 代码,我几乎能够理解所有的代码,因为我已经能够在任何地方找到文档..但是例如对于这个我仍然无法弄清楚确切的含义(我无法找到注解@P ):

public MyFileEvent getEvent(
        @P("user") User user,
        @P("file") @Valid @RequestBody EventFile file) throws MyException {

    return myService.getFileEvent(file);
}

I understand @Valid and @RequestBody but I don't find the meaning of @P .我了解@Valid@RequestBody但我找不到@P的含义。

According to the javadoc :根据javadoc

"An annotation that can be used along with AnnotationParameterNameDiscoverer to specify parameter names. This is useful for interfaces prior to JDK 8 which cannot contain the parameter names." “可以与AnnotationParameterNameDiscoverer一起使用以指定参数名称的注释。这对于 JDK 8 之前不能包含参数名称的接口很有用。”

There are in fact two versions of the @P annotation: @P注解实际上有两个版本:

  • org.springframework.security.access.method.P since Spring 3.2 (deprecated) org.springframework.security.access.method.P自 Spring 3.2(已弃用)
  • org.springframework.security.core.parameters.P since Spring 5.0 org.springframework.security.core.parameters.P自 Spring 5.0

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

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