【问题标题】:What do these Spring debug messages mean?这些 Spring 调试消息是什么意思?
【发布时间】:2011-09-07 01:09:52
【问题描述】:

我在独立的 Java 应用程序中使用 Spring IoC。当应用程序启动时,它会创建一个包含启动信息的日志。有些消息我不明白,请帮助我理解它们并解释如果必须修复它们如何修复它们?另外我很好奇:这些消息对我的应用程序稳定性有什么危害吗?

让我害怕的消息以“无法”一词开头。目前,该应用程序运行良好。

INFO - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@52cc95d: startup date     [Thu Jun 02 16:02:12 MSD 2011]; root of context hierarchy
INFO - Loading XML bean definitions from class path resource [application-config.xml]
DEBUG - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
DEBUG - Loading schema mappings from [META-INF/spring.schemas]
DEBUG - Loaded schema mappings: {http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd}
DEBUG - Loading bean definitions
DEBUG - Loaded 3 bean definitions from location pattern [application-config.xml]
DEBUG - Bean factory for org.springframework.context.support.ClassPathXmlApplicationContext@52cc95d: org.springframework.beans.factory.support.DefaultListableBeanFactory@33aae94f: defining beans [propertyPlaceholderConfigurer,dbWorker,connectionPool]; root of factory hierarchy
DEBUG - Creating shared instance of singleton bean 'propertyPlaceholderConfigurer'
DEBUG - Creating instance of bean 'propertyPlaceholderConfigurer'
DEBUG - Eagerly caching bean 'propertyPlaceholderConfigurer' to allow for resolving potential circular references
DEBUG - Finished creating instance of bean 'propertyPlaceholderConfigurer'
INFO - Loading properties file from class path resource [config.properties]
DEBUG - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@49bdc9d8]
DEBUG - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@255d17d7]
INFO - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@33aae94f: defining beans [propertyPlaceholderConfigurer,dbWorker,connectionPool]; root of factory hierarchy
DEBUG - Returning cached instance of singleton bean 'propertyPlaceholderConfigurer'
DEBUG - Creating shared instance of singleton bean 'dbWorker'
DEBUG - Creating instance of bean 'dbWorker'
DEBUG - Eagerly caching bean 'dbWorker' to allow for resolving potential circular references
DEBUG - Creating shared instance of singleton bean 'connectionPool'
DEBUG - Creating instance of bean 'connectionPool'
DEBUG - Eagerly caching bean 'connectionPool' to allow for resolving potential circular references
DEBUG - Finished creating instance of bean 'connectionPool'
DEBUG - Finished creating instance of bean 'dbWorker'
DEBUG - Returning cached instance of singleton bean 'connectionPool'
DEBUG - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@4b1c2b67]
DEBUG - Returning cached instance of singleton bean 'lifecycleProcessor'

【问题讨论】:

    标签: spring messages spring-jdbc


    【解决方案1】:

    如果您明确定义了这些 bean,那么您可能会遇到问题,因为 Spring 会注入错误的类型,因为它没有找到您的自定义 bean。但是,如果您没有定义这些 bean,那么这些消息是良性的。 Spring 只是让您知道正在使用默认 bean - 正如@Phill 已经回答的那样。

    【讨论】:

    • 好的,那我接受菲尔斯的回答。感谢您的反馈!
    【解决方案2】:

    这只是您可能不需要的调试级别输出。本质上,它告诉您您没有定义任何覆盖其默认功能的特定类,因此它将使用默认功能。这里没有什么可担心的。

    【讨论】:

    • 您好菲尔,感谢您的回复。实际上我自己理解它(如果我设法编写应用程序:-)。我需要更多细节。那些无法实现的东西实际上意味着什么。无法 - 对算钱的应用来说是个坏词……我想。但你的回复让我放松了一点……
    • @MinimeDJ 在这种情况下,我建议您阅读有关 MessageSource、ApplicationEventMulticaster 和 LifecycleProcessor 的 Javadocs。 Spring 的全部意义在于您可以自定义它的一部分。日志输出告诉你的只是它使用的是默认功能而不是自定义功能。
    • @MinimeDJ:调试级别的日志消息是您无需担心的事情。将您的根日志记录级别设置为警告,然后为您想要更多详细信息的特定包添加较低的日志记录级别,例如您的应用程序代码。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-13
    • 2010-10-01
    • 2015-06-22
    • 1970-01-01
    • 1970-01-01
    • 2021-11-16
    相关资源
    最近更新 更多