简体   繁体   中英

How can I find out what is registering a Spring bean?

I have an application with a complex mix of @Import s and @ComponentScan s.

There is a class marked as @Component that I expected not to be added to the application context, but it is, and I want to climb back the scan chain to find out why is that bean registered.

Is there any easy way I can do that eg by using Spring Tools 4 Eclipse's plug-in features or maybe programmatically? Googling keywords led to no result.

Enable the actuator and look at the beans endpoint (/actuator/beans).

The resource property tells you, where this bean might have been included.

bean 定义资源

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM