錯誤:Type referred to is not an annotation type: CacheFind


報錯 java.lang.IllegalArgumentException: error Type referred to is not an annotation type: CacheFind

解析:

在使用注解的方式進行切面的時候,報以上錯誤,

注解如下:

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface CacheFind {
	
	public String key(); //標識存入redis中key的前綴
	public int seconds() default 0; //標識保存的時間
	
}

切面如下:

image-20200813170458641

圖中的標記就是錯誤的原因

必須方法中參數與注解傳入參數必須一致

正確寫法:

image-20200813170807948

即可解決


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM