`
alph0618
  • 浏览: 55559 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Aspect出现error Type referred to is not an annotation type

 
阅读更多

使用Aspect记录操作日志时,启动项目报以下异常:

严重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcContentNegotiationManager': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error Type referred to is not an annotation type: log

 实现代码:

/**
	 * 前置通知,用于拦截controller层的操作
	 * 
	 * @param joinPoint
	 * @param log
	 */
	@Before("controllerAspect() && @annotation(log)")
	public void doBefore(JoinPoint joinPoint, SystemControllerLog sysLog) {
		HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
				.getRequest();
		String ip = request.getRemoteAddr();
		logger.info("ip:" + ip);
	}

 原因是@Before里的注解和方法中的参数名不一致,改为一致后启动正常:

/**
	 * 前置通知,用于拦截controller层的操作
	 * 
	 * @param joinPoint
	 * @param log
	 */
	@Before("controllerAspect() && @annotation(sysLog)")
	public void doBefore(JoinPoint joinPoint, SystemControllerLog sysLog) {
		HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
				.getRequest();
		String ip = request.getRemoteAddr();
		logger.info("ip:" + ip);
	}

 

 

分享到:
评论

相关推荐

    Android代码-threetenbp

    The backport is NOT an implementation of JSR-310, as that would require jumping through lots of unnecessary hoops. Instead, this is a simple backport intended to allow users to quickly use the JSR-310...

    Annex17_RoCEv2 (1).pdf

    This document is an annex to Volume 1 release 1.2.1 of the InfiniBand Architecture, herein referred to as the base specification. This annex is Optional Normative, meaning that implementation of the ...

    webMethods Developer Guide

    webMethods Developer is a graphical development tool that you use to build edit and test integration logic It provides an integrated development environment in which you can develop the logic and ...

    Chinese Entity Linking Comprehensive

    The goal of Entity Linking is to determine whether or not the entity referred to in each query has a matching entity node in the reference Knowledge Base (KB) (LDC2014T16). If there is a matching node...

    高中英语 知识点大全10 8refer torefer…to

    - The book which you referred to is not in the library. 你提到的那本书不在图书馆。 - His report refers to the situation in the Middle East. 他的报告提到了中东的局势。 2. 当“refer”作为及物动词使用...

    数据恢复的工具

    简单恢复IMPORTANT-READ CAREFULLY: This End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) later referred to as "LICENSEE" and MT Solution ...

    Error: L6218E: Undefined symbol delay-init (referred from main.o

    这是我们需要添加的含有delay_init函数的源文件

    NIST SP800-57pt2r1.pdf

    users and systems need to have assurance that the key is authentic, that it belongs to the entity with whom or which it is asserted to be associated, and that it has not been accessed by an ...

    IAR常见错误详解IAR常见错误列表

    Error[e16]: Segment CSTACK (size: 0x50 align: 0x1) is too long for segment definition. At least 0x50 more bytes needed. 这是因为定义的全局变量和数组缓冲区超出了硬件支持的RAM限制,解决方法是减少不必要...

    Manning-AspectJInAction

    I’ve always felt that ...It is not often that one gets to write about such an exciting new programming methodology and language. I enjoyed writing this book. I hope you will enjoy reading it.

    ajax in prpc

    Dojo is often referred to as an AJAX framework because of its robust support for AJAX functionalities. AJAX (Asynchronous JavaScript and XML) is a technique used for creating faster and more ...

    微软内部资料-SQL性能优化2

    A reference to an invalid page (a page that is not in your working set) is referred to as a page fault. Assuming the page reference does not result in an access violation, a page fault can be either ...

    VMware vCloud Architecting a vCloud

    This document is not intended to be a substitute for detailed product documentation, nor is it a step-by-step guide for installing a vCloud. You should have access to the following documentation ...

    intro-linux.zip_Home For Good_anlinux官网

    It is geared to an audience of both corporate as well as home users. It is not intended to be a full overview of Unix operations, as there are several good texts available as well as on?line ...

    netterm_ssh_linux连接工具

    The connection type is referred to as Modem and TCPIP respectively. Although NetTerm contains many options, a new user can get up and running very quickly once the connection type is determined. For ...

    软件架构模式

    one another This is commonly referred to as the big ball of mud architecture anti pattern ">It’s all too common for developers to start coding an application without a formal architecture in place ...

    acpi控制笔记本风扇转速

    operand to be an operation region of any type. It is now restricted to regions of type SystemMemory, as per the ACPI specification. BZ 481 Additional cleanup and optimizations for the new Table ...

    ADC 输入噪音问题.pdf

    Only a small amount of input-referred noise is needed to increase the resolution by the averaging technique; however, use of increased noise requires a larger number of samples in the average, so ...

    Arduino Cookbook 2nd 原版pdf by Margolis

    This type of technology, often referred to as physical computing, is used in all kinds of things from the iPhone to automobile electronics systems. Arduino makes it possible for anyone with an ...

Global site tag (gtag.js) - Google Analytics