How can i find out in what order my beans were created?
+1 for anyone who can recomme开发者_如何学Pythonnd a tool to display it visually.
If you want to find out the order of bean creation, you can register a custom BeanPostProcessor that prints out the info you are interested in. Follow the link for a Spring 2.5.x example.
If you want to view the bean configuration before any actual bean creation, then register a custom BeanFactoryPostProcessor that prints out the info you are interested in. Follow the link for a Spring 2.5.x example.
In either case, if you want to display the info visually then your PostProcessors could easily create a JFrame with a JList and add the info to that.
How can i find out in what order my beans were created?
One way would be to set the log4j logging level to DEBUG and trawl through the chatter in the log files. Not elegant, I'll grant you.
I believe spring creates beans in the order it finds them in the spring cfg files unless u explicitly state dependencies among them using depends-on.
Best way is to put the log4j log level to DEBUG mode and use grep to filter out only lines showing bean creation 'completion'.
精彩评论