spring五:获取容器中对象信息
生活随笔
收集整理的這篇文章主要介紹了
spring五:获取容器中对象信息
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
// 獲取容器中對象信息@Testpublic void test2(){String configLocation = "applicationContext.xml"; // 類路徑的根目錄// 會創建對象ApplicationContext ctx = new ClassPathXmlApplicationContext(configLocation);// 獲取容器中定義的對象個數int counts = ctx.getBeanDefinitionCount();System.out.println("容器中定義對象個數:"+counts);// 獲取容器中定義的對象的名稱String names[] = ctx.getBeanDefinitionNames();for(String name : names){System.out.println("容器中定義對象名稱:"+name);}}
?
總結
以上是生活随笔為你收集整理的spring五:获取容器中对象信息的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 前端一HTML:十三:css的三大特性
- 下一篇: spring6:bean的生命始末方法