I have a large Spring 2.x-based application with a couple of hundreds of applicationContext.xml files and several thousands beans/bean factories.
Most of these XML configurations say something like default-autowire="byName", effectively turning on the autowiring, but only a fraction of beans is actually autowired. Most of the bean properties are set explicitly.
(This is to historical reasons, I guess that’s how you call it when you were not clever enough in the past.)
Now we would like to remove autowiring at all. We believe that only a small fraction of beans is actually autowired – but we do not know, what and were exactly. My question is:
How can we find out what and were exactly is autowired by Spring?
Ideally, we need to get a list of beans/properties so that we could inject these explicitly in out XML configurations. But before diving into Spring internals with a debugger, I decided to ask if someone on SF has maybe already solved a similar task.
ps. I don’t have an intention to discuss whether autowiring is good or bad. We have a number of internal technical reasons to remove autowiring, that’s all.
You can try to enable DEBUG logging in Spring. It prints a lot of information during initialisation phase. I bet auto-wiring messages are also printed out. You just need to find that message and then parse the log file after application is fully initialised.
UPDATE: I believe AbstractAutowireCapableBeanFactory is responsible for auto-wiring logic. You can check autowireByName method. It produces the following log message which you can search for in the log file: