第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何將屬性值注入使用注釋配置的Spring Bean?

如何將屬性值注入使用注釋配置的Spring Bean?

一只斗牛犬 2019-07-27 15:24:40
如何將屬性值注入使用注釋配置的Spring Bean?我有一堆Spring bean,它們是通過注釋從類路徑中獲取的,例如@Repository("personDao")public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao {     // Implementation omitted}在Spring XML文件中,定義了一個PropertyPlaceholderConfigurer:<bean id="propertyConfigurer"    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">     <property name="location" value="/WEB-INF/app.properties" /></bean>我想將app.properites中的一個屬性注入上面顯示的bean中。我不能簡單地做一些事情<bean class="com.example.PersonDaoImpl">     <property name="maxResults" value="${results.max}"/></bean>因為PersonDaoImpl在Spring XML文件中沒有特征(它是通過注釋從類路徑中獲取的)。我有以下幾點:@Repository("personDao")public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao {     @Resource(name = "propertyConfigurer")     protected void setProperties(PropertyPlaceholderConfigurer ppc) {     // Now how do I access results.max?      }}但是我不清楚我如何訪問我感興趣的房產(chǎn)ppc?
查看完整描述

3 回答

?
catspeake

TA貢獻1111條經(jīng)驗 獲得超0個贊

有一個新的注釋@Value春季3.0.0M3。@Value不僅支持#{...}表達式,還支持${...}占位符


查看完整回答
反對 回復 2019-07-27
  • 3 回答
  • 0 關注
  • 908 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號