Spring AOP: get access to argument names

后端 未结 4 1243
小鲜肉
小鲜肉 2020-12-16 05:26

I\'m using Spring 3.x, Java 6.

I have an @Around aspect with the following joinpoint:

@Around(\"execution(public * my.service.*.*Connector.*(..))\")
         


        
4条回答
  •  甜味超标
    2020-12-16 05:34

    In Java 8 there is a new compiler flag that allows additional metadata to be stored with byte code and these parameter names can be extracted using the Parameter object in reflection. See JDK 8 spec. In newer versions of hibernate org.springframework.core.ParameterNameDiscoverer uses this feature. To use it compile using javac with this flag:

    -parameters                Generate metadata for reflection on method parameters
    

    Access parameters using reflection's Parameter class.

提交回复
热议问题