无法致电AOP是建议

时间:2019-05-08 14:35:57

标签: java spring spring-aop

调用userData方法时,Aop无法触发。

@RequestMapping(value = "/service/userDate", method = RequestMethod.POST)
public ResponseEntity<Response> UserApp(@RequestBody UserVO userVO) {
    Response res = new Response(HttpStatus.OK.value());
    try {
        logger.debug("UserController : </ UserApp> ");
        res = userService.userApp(userVO);
        return new ResponseEntity<>(res, HttpStatus.OK);
    } catch (Exception e) {
        logger.error("Exception in approveUser" + e.getMessage());
        return new ResponseEntity<>(
                new Response(ErocErrorConstants.ERROR_STRING, HttpStatus.EXPECTATION_FAILED.value()),
                HttpStatus.BAD_REQUEST);
    }
}
package com.gf.service

public class UserService {
    @Transactional
    public Response userData(User userData) {
    }
}
@Aspect
public class EmailAopService {
    @Pointcut("execution(* com.gf.service.UserService.userData(..)) && args(userData))")
    private void selectAll() {}

    @Before("selectAll()")
    public void logBefore(User userData) {
        //
    }
}

0 个答案:

没有答案