2011-06-02 79 views
8

我在獨立的Java應用程序中使用Spring IoC。當應用程序啓動時,它會創建一個包含啓動信息的日誌。有些信息我不明白,請幫助我理解它們並解釋如何修復它們,如果它們必須修復?另外我很好奇:由於這些消息,我的應用程序穩定性是否存在危險?這些Spring調試消息是什麼意思?

嚇跑我的消息從單詞「Unable」開始。目前該應用程序工作得很好。

INFO - Refreshing org[email protected]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[email protected]52cc95d: org.s[email protected]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 [[email protected]c9d8] 
DEBUG - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.[email protected]255d17d7] 
INFO - Pre-instantiating singletons in org.s[email protected]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 [[email protected]1c2b67] 
DEBUG - Returning cached instance of singleton bean 'lifecycleProcessor' 

回答

13

這只是您可能不需要的調試級別輸出。從本質上講,它告訴你,你還沒有定義任何覆蓋其默認功能的特定類,所以它將使用默認功能。這裏沒有什麼可擔心的。

+0

嗨菲爾,謝謝你的回覆。其實我自己明白(如果我設法寫應用程序:-)。我需要更多細節。那些無法實際意義的東西。無法 - 對於計算金錢的應用程序而言是個壞詞......我想。但您的回覆讓我放鬆了一下... – Worker 2011-06-02 12:30:37

+0

@MinimeDJ在這種情況下,我建議您閱讀MessageSource,ApplicationEventMulticaster和LifecycleProcessor的Javadocs。 Spring的全部意義在於你可以自定義它的一些部分。所有日誌輸出告訴你,它使用默認功能,而不是自定義功能。 – 2011-06-02 12:32:23

+1

@MinimeDJ:調試級日誌消息是您不需要擔心的事情。設置你的根日誌記錄級別警告,然後爲你想要更多細節的特定包添加更低的日誌記錄級別,比如你的應用程序代碼。 – 2011-06-02 12:34:32

2

如果您已經明確定義了任何這些bean,那麼您可能會遇到問題,因爲Spring將注入錯誤的類型,因爲它沒有找到您的自定義Bean。但是,如果你還沒有定義這些bean,那麼這些消息是良性的。 Spring只是讓你知道默認的bean正在被使用 - 正如@Phill已經回答的那樣。

+0

好的,我接受Phills的答案。感謝您的反饋意見! – Worker 2011-06-02 13:06:05