Bean重名報錯 解決方案

2021-10-12 12:57:56 字數 581 閱讀 7746

有時候會有類重名的現在,普通情況下我們只需要更名其中乙個類就可以解決,但是在某些特殊情況下我們不想要更名,這個時候我們就可以使用別名策略那解決

舉個例子,我有兩個tokenprovider,乙個依賴包的,乙個本地的,都叫這個名字,但我的securityconfiguration中想注入本地的.這時候在本地的tokenprovider的component註解中加入別名,預設是value,可以寫也可以不寫(完整寫法是 @component(value=「***xx」))

@component

("microservicetokenprovider"

)public

class

tokenprovider

{

接下來,在使用這個類的地方使用qualifier註解就行了

@autowired

@qualifier

("microservicetokenprovider"

)private tokenprovider tokenprovider ;

JS重名解決方案

乙個頁面如果引用多個js,或者像asp.net mvc,乙個檢視包含多個子檢視,每個子檢視有自己的js,那麼變數 函式的重名衝突機會將會大增。如何解決?這裡有乙個方案 1 用類來封裝子頁的js 這種模式中,凡需要被外部訪問,如html控制項訪問的,就定義成公有函式,其他的就是類內部的私有函式,衝突的...

CXF報錯及解決方案

報錯資訊,是專案實施中遇到的問題。解決方案是基於網上各路豪俠的解決方案綜合得出的。1.org.apache.cxf.binding.soap.soapfault the namespace on the definitions element,is not a valid soap version....

ireport啟動報錯解決方案

ireport啟動報錯解決方案 ireport啟動報錯 ireport cannot find jdk jdk5.0 or newer cannot be found in your mathine 上網搜了些文章,試了試幾個關鍵字都沒有發現解決方法,最後想可能用en會好些 如此平凡的問題 果然,i...