Spring boot 在Spring引导方面没有获得实际的参数名

Spring boot 在Spring引导方面没有获得实际的参数名,spring-boot,spring-data-jpa,aspectj,spring-aop,Spring Boot,Spring Data Jpa,Aspectj,Spring Aop,我试图在使用Aspectj动态执行每个方法之前添加日志语句 代码: @组件 @面貌 公共类方法记录器{ DiagnosticLogger=DiagnosticLogger.getLogger(getClass()); @在(“执行(*com.xyz..*(..))之前) public void beforeMethod(JoinPoint JoinPoint)抛出可丢弃的{ System.out.println(“Class*******”+joinPoint.getTarget().getCl

我试图在使用Aspectj动态执行每个方法之前添加日志语句

代码:

@组件
@面貌
公共类方法记录器{
DiagnosticLogger=DiagnosticLogger.getLogger(getClass());
@在(“执行(*com.xyz..*(..))之前)
public void beforeMethod(JoinPoint JoinPoint)抛出可丢弃的{
System.out.println(“Class*******”+joinPoint.getTarget().getClass().getName());
MethodSignature=(MethodSignature)joinPoint.getSignature();
System.out.println(“方法*******”+签名.getName());
//附加参数
对象[]args=joinPoint.getArgs();
String[]parameterNames=signature.getParameterNames();
if(参数名称!=null){
对于(int i=0;i
输出:

Class*******com.xyz.security.web.UserController
方法******放弃密码
参数名称*******用户电子邮件:naresh@xyz.com
类******com.xyz.security.service.impl.UserServiceImpl
方法******放弃密码
参数名称*******用户电子邮件:naresh@xyz.com
类******com.sun.proxy.$Proxy436
方法******findByUserEmail
我能够达到控制器和服务级别。但是当谈到SpringDataJPA存储库方法时,它无法打印。
如何在存储库级别获取参数名?

这里是我所做工作的一个示例

通过添加+符号,还可以拦截在com.example.*中实现我的存储库或任何其他接口的类

@Slf4j
@组成部分
@面貌
公共类方法记录器{
@在(“执行(*com.example.*.+.*(…))之前)
public void beforeMethod(JoinPoint JoinPoint)抛出可丢弃的{
log.info(“Class******”+joinPoint.getTarget().getClass().getName());
对于(类接口:joinPoint.getTarget().getClass().getInterfaces()){
log.info(“接口*******”+接口.getName());
}
MethodSignature=(MethodSignature)joinPoint.getSignature();
log.info(“方法******”+签名.getName());
对象[]args=joinPoint.getArgs();
String[]parameterNames=signature.getParameterNames();
if(参数名称!=null){
对于(int i=0;i
还将记录参数名称:

Class******com.sun.proxy.$Proxy87
接口******com.example.demoaspectmethodlogging.control.EmployeeRepository
接口******org.springframework.data.repository.repository
接口******org.springframework.transaction.interceptor.TransactionalProxy
接口******org.springframework.aop.framework.com
接口******org.springframework.core.DecoratingProxy
方法******findByName
参数名称*******名称:Simon
感谢您的回复。如果(joinPoint.getTarget()instanceof Proxy){System.out.println(“joinPoint.getTarget()instanceof Proxy”);joinPoint.getTarget().getClass().getInterfaces();}现在如何获取方法参数?