从 Spring 上下文配置中输出类路径内容
Spring 是否提供了在上下文配置文件中加载资源时输出类路径环境变量的实际内容的方法?
<!-- Import the special context -->
<import resource="classpath:mySpecialApplicationContext.xml"/>
我将 Springframework 类的 Log4J 日志记录级别设置为 ALL,但框架似乎并未记录该值。我试图弄清楚 Spring 是否从依赖项加载它,并且我想在应用程序运行时查看类路径设置。该应用程序由 Maven 构建,具有许多依赖项。
如果类路径中有两个或多个 mySpecialApplicationContext.xml,Spring 使用哪一个?
谢谢。
Does Spring provide any way to output the actual content of the classpath environment variable when it is loading a resource in a context configuration file?
<!-- Import the special context -->
<import resource="classpath:mySpecialApplicationContext.xml"/>
I set the Log4J logging level to ALL for Springframework classes but this value does not appear to be logged by the framework. I am trying to figure out if Spring is loading this from a dependency, and I want to see the classpath setting during application runtime. The application is built by Maven with many dependencies.
If there are two or more mySpecialApplicationContext.xml's in the classpath, which one does Spring use?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 http://goo.gl/9dK2c 看到相关的(我认为)源代码
简而言之:
当类路径中存在多个匹配资源时,加载内容的详细信息取决于 ClassLoader - DefaultResourceLoader 使用线程的类加载器,但通常会使用找到的第一个类加载器。
You can see the relevant (I think) source code at http://goo.gl/9dK2c
In short:
No, the classpath is not logged
The details of what would be loaded when there is more than one matching resource in the classpath are ClassLoader dependent - the DefaultResourceLoader uses the thread's classloader, but typically, the first one found would be used.