2012-02-17 36 views
-1

爲什麼Spring使用「.xml」文件格式的配置,Spring ..爲什麼要以XML文件格式配置

有沒有可能在「.properties」文件中配置?

+1

爲什麼天空是藍色的? Spring使用它,因爲這就是他們想要使用的。它可能是一個.ini文件,它可能是一個.txt文件 - 他們選擇.xml。 – 2012-02-17 04:50:25

回答

1

當Spring處於初期階段時,Xml是指定配置的事實上的方法。從spring3開始,可以使用註釋來代替xml。 但是,您仍然需要首先加載spring上下文(使用xml配置文件),其餘基於spring的配置將通過spring註釋加載。 是的,你可以指定單獨的屬性文件進行名稱 - 值對

<context:property-placeholder location="classpath:filename.properties"/> 
相關問題