設計模式——策略模式應用

公司的Auth服務使用了策略模式來實現對不同算法的動態處理,學習一下 先盜圖一張,模式圖如下 先定義一個Strategy接口 public interface AuthStrategy{ //用於動態匹配策略 match(str); //執行鑑權操作 doAuth(); } 定義幾個不同的實現類: @Component public class UserTokenSt
相關文章
相關標籤/搜索