2014-10-18 103 views
0

我已經使用了多年的春天,但似乎無法找到這一個文件。如果我有這樣配置的彈簧豆:春天屬性值 - res:URI

<bean id="myBeanInstance" class="org.mybean"> 
    <property name="path" value="res:a-string-goes-here"/> 
</bean> 

該值被解釋爲純粹的字符串? 'res:'如何影響任何內容以及它在何處被解釋?任何指向相應文檔的指針都會很棒。

謝謝!

回答

0

是,該值僅解釋爲串...
除非你有一個的BeanFactoryPostProcessor,如古怪配置PropertyPlaceholderConfigurer或一些自定義的BeanFactoryPostProcessor採取這種價值觀的照顧。

還要注意,因爲春天3「:」是默認屬性值默認分隔符,也就是說,如果你有PropertyPlaceholderConfigurer使用默認設置,值「$ {清晰度:無論}」將被視爲屬性'res',默認值爲'whatever'。

+0

謝謝,這是有道理的,但具體文件在哪裏呢? – Mark 2014-10-20 04:44:15

+0

在BeanFactoryPostProcessor上:http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#beans-factory-extension-factory-postprocessors。在PropertyPlaceholderConfigurer上:http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#beans-factory-placeholderconfigurer。默認值 - 在參考中找不到,但在此處解釋,例如:http://www.javacodegeeks.com/2013/01/spring-property-placeholder-configurer-a-few-not-so-obvious-options html的 – Alexander 2014-10-21 13:10:09