如何让Spring打印通过组件扫描获取的bean定义? [英] How do I get Spring to print out the bean definitions it is picking up via component scanning?
问题描述
我有一个配置用于组件扫描的spring应用程序,是否有一个我可以打开的标志或选项会导致spring打印出spring框架扫描程序选择的类的完全限定名称?
I have a spring app that is configured for Component Scanning, is there a flag or option that I can turn on that would cause spring to print out the fully qualified names of the classes that the spring framework scanner picks up?
推荐答案
您可以通过配置日志记录类别(假设您使用的是log4j)进行打印,并在调试级别设置org.springframework.context.annotation
.
You can print this by configuring logging category (assuming you are using log4j), set org.springframework.context.annotation
at debug level.
检查org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(String)
.
您可以看到该类是调试级别的类的日志记录名称.在Spring 3.0.5版本中进行了验证.
You can see the class is logging name of the classes at debug level. Verified in Spring 3.0.5 version.
这篇关于如何让Spring打印通过组件扫描获取的bean定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!