我正在嘗試使用 @EnableGlobalMethodSecurity 注釋擴(kuò)展 GlobalMethodSecurityConfiguration。我有一個單獨的配置類,它使用 @EnableWebSecurity 注釋擴(kuò)展 WebSecurityConfigurerAdapter。如果我將 @EnableGlobalMethodSecurity 放在我的 WebSecurityConfigurerAdapter 上而不是我的 GlobalMethodSecurityConfiguration 類上,我可以在 CglibAopProxy 中看到該方法正在被攔截然后調(diào)用。如果我從 WebSecurityConfigurerAdapter 中刪除 @EnableGlobalMethodSecurity 并將其放在 GlobalMethodSecurityConfiguration 上,我將不再看到任何方法攔截。兩種配置是否沖突?有誰知道為什么在配置 GlobalMethodSecurityConfiguration 后我的方法不再被正確調(diào)用。我希望通過擴(kuò)展 GlobalMethodSecurityConfiguration 來實現(xiàn)方法安全性,以便我可以提供自己的處理程序和表達(dá)式根。如果需要,我可以提供代碼片段。
1 回答

侃侃無極
TA貢獻(xiàn)2051條經(jīng)驗 獲得超10個贊
不是 100% 確定為什么自動裝配我自己的服務(wù),將它們注冊為 beans 會阻止方法攔截的發(fā)生。我懷疑這是因為它使用了不同的應(yīng)用程序上下文。
添加回答
舉報
0/150
提交
取消