debugging - 如何开启Spring的组件扫描调试信息?

标签 debugging spring-mvc logging

我试图找出我正在维护的应用程序使用的数据库表的数量。我的 appContext.xml 中有这个

 <context:component-scan base-package="com.foo, com.bar" use-default-filters="false">
 <context:include-filter type="annotation" expression="org.springframework.stereotype.Service" />
 <context:include-filter type="annotation" expression="org.springframework.stereotype.Component" />
 <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
 </context:component-scan>
         ....
 <jpa:repositories base-package="com.foo.abc, com.bar.def" />

还有与此项目相关的其他子项目,其中广泛使用了 @Entity@Repository。我在想,如果我能够以某种方式打开 Spring 的调试,它将列出所有类名,当它基于基本包扫描它们时,我应该能够找到所有 jpa 存储库。我怎样才能打开 springs 调试来吐出这些信息?

这是我的 log4j.properties 中的内容:

log4j.rootLogger=error, file
log4j.category.org.hibernate=debug, hb
log4j.category.org.springframework=debug, spring

最佳答案

这是一个有点老的话题,但我找到了适合我的解决方案(Spring 4.1.7):

<logger name="org.springframework.core.io.support" level="debug"/>
<logger name="org.springframework.context.annotation" level="debug"/>

关于debugging - 如何开启Spring的组件扫描调试信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22599238/

相关文章:

java - 将过滤器 bean 添加到 ServletContext

python-3.x - Python 日志记录调用在 useTime 崩溃

java - Log4JLoggerAdapter 处的 SLF4J NoSuchMethodError

c# - 在异常构造函数中记录错误是一种好习惯吗?

python - 如何让 Python 的单元测试不捕获异常?

堆损坏,C 中的错误

c++ - Visual Studio Express 2010 C++ 反汇编调试

php - 如何在 PHP 中获取有用的错误消息?

java - 我可以创建 spring mvc 自定义验证注释而不链接到 validator 实现吗

java - Spring MVC 异步任务同步运行