views:

54

answers:

4

How can i find out in what order my beans were created?

+1 for anyone who can recommend a tool to display it visually.

A: 

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.

Pangea
A: 

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.

Stephen C
A: 

Best way is to put the log4j log level to DEBUG mode and use grep to filter out only lines showing bean creation 'completion'.

Gopi
+1  A: 

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.

Paul Grime