重寫ContextLoaderListener,對(duì)于web應(yīng)用,容器類型為XmlWebApplicationContext,在該類中設(shè)置allowBeanDefinitionOverriding為false,然后在spring啟動(dòng)時(shí),碰到同名bean就會(huì)拋出異常。 案例如下 1 2 3 4 5 6 7 8 9 publicclassTradeContextLoaderListenerextendsContextLoaderListener { ...
www.dbjr.com.cn/article/2235...htm 2025-5-22