我试图在方面类中注入HttpHeader
。
这是代码:
public aspect RestRequestsAspect {
@Context HttpHeaders httpHeaders;
@Before("endPointsInterfacesCut() || servicesCut() || patternCrudCut()")
public void beforeCreate(JoinPoint joinPoint) {
printLogTrace(joinPoint);
}
private void printLogTrace(JoinPoint joinPoint) {
if (this.httpHeaders != null)
LoggerFactory.getLogger(joinPoint.getTarget().getClass().getName()).info(httpHeaders.toString());
}
}
它没有记录任何内容,因此HttpHeader
必须为null。
CDI需要将HttpHeader
注入方面?