2013-07-03 18 views
2

我正在將beans與FileSystemXmlApplicationContext加載到上下文中。從spring中查找bean定義文件名FileSystemXmlApplicationContext

有包括一些額外的資源文件:

import resource="beandef_1.xml" 
import resource="beandef_2.xml" 

我正在尋找可能找出bean定義源文件。

確定從哪個xml文件中加載bean是否可行?

許多THX

+0

http://stackoverflow.com/questions/10624152/find-which-spring-context-file-loaded-bean – Anil

回答

2

試試這個

FileSystemXmlApplicationContext ctx = ... 
String res = ctx.getBeanFactory().getBeanDefinition("bean1").getResourceDescription(); 
+0

的重複感謝您快速響應。 現在它適用於我! – user2545772

相關問題