需求:通過spring aop 提供的面向切面程式設計的思想,利用自定義註解的方式,實現對介面的功能的增強
一:自定義乙個註解類
@target:指明了修飾的這個註解的使用範圍,即被描述的註解可以用在**
二:切面邏輯@documented
@retention(retentionpolicy.runtime)
@target(elementtype.method)
public @inte***ce myannotation
三:controller測試類@aspect
@component
public class aopcache
@around("addadvice()")
public object interceptor(proceedingjoinpoint pjp) throws throwable
expression expression = parser.parseexpression(lockkey);
string id = expression.getvalue(context, string.class);
expression = parser.parseexpression(cachekey);
string number = expression.getvalue(context, string.class);
system.out.print("cachekey: "+number+" ,lockkey: "+id);
if (lockkey.equals("abc"))
} catch (nosuchmethodexception e)
return pjp.proceed();
}private method gettargetmethod(proceedingjoinpoint pjp) throws nosuchmethodexception
}
@restcontroller
public class democontroller
@myannotation(lockkey = "#id",cachekey = "#number")
public string adddata3(string id,string number)
public string adddata4(string id,string number)
}
(二)zookeeper實戰篇
a.安裝jdk b.安裝zookeeper 通過filezilla將zookeeper傳到linux下的 opt software下並chaos u x zookeeper 3.4.10.tar.gz 然後解壓到 opt module 下 c.修改配置 將 opt module zookeeper ...
效能測試 實戰篇
bug的表現 拆分物件 然後從功能實現上來看,怎麼實現這個完整功能的。通常這些業務功能操作都對應著乙個或多個請求 可能能是不同型別的請求,比如 http,mysql 等 我們要做的是找出這些操作對應的請求,請求之間的順序是怎麼樣的。指標分析 常用分析思路 2 8 法則 正態分佈 按比例倍增 響應時間...
DirectShow之介面實戰篇(一)
directshow之介面實戰篇 一 既然是介面實戰篇,就先把一些常用的介面列出來,讓大家有一些基本的認識,都是用來做什麼的,什麼時候我們會需要用到此介面。ifiltergraph過濾通道介面ifiltergraph2增強的ifiltergraphigraphbuilder最為重用的com介面,用於...