亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

spring應用索引的使用

spring應用索引的使用

侃侃無極 2022-11-30 13:47:18
有人可以澄清財產的用途是什么spring.application.index以及我們為什么需要它嗎?應用.yml:spring:    application:        name: ServiceName        index: 
查看完整描述

2 回答

?
搖曳的薔薇

TA貢獻1793條經驗 獲得超6個贊

據我所知,spring.application.index自 version 以來已被認為已棄用2.0.0.RC1。我通過比較以下這些附錄來判斷:

通過檢查ContextIdApplicationContextInitializer這些版本的源代碼可以證明前面的說法:

/**

 * Placeholder pattern to resolve for application index. The following order is used

 * to find the name:

 * <ul>

 * <li>{@code vcap.application.instance_index}</li>

 * <li>{@code spring.application.index}</li>

 * <li>{@code server.port}</li>

 * <li>{@code PORT}</li>

 * </ul>

 * This order favors a platform defined index over any user defined value.

 */`"${vcap.application.instance_index:${spring.application.index:${server.port:${PORT:null}}}}"`

版本2.0.0.RC1 ContextIdApplicationContextInitializer??赡軙l現索引是自動遞增的 using AtomicLong,這也確保了它的唯一性。有關源代碼中的更多詳細信息,請參閱內部ContextIdApplicationContextInitializer$ContextId類。關鍵方法是它的構造函數:


ContextId createChildId() {

    return new ContextId(this.id + "-" + this.children.incrementAndGet());

}


查看完整回答
反對 回復 2022-11-30
?
回首憶惘然

TA貢獻1847條經驗 獲得超11個贊

/**

 * Placeholder pattern to resolve for application index. The following order is used

 * to find the name:

 * <ul>

 * <li>{@code vcap.application.instance_index}</li>

 * <li>{@code spring.application.index}</li>

 * <li>{@code server.port}</li>

 * <li>{@code PORT}</li>

 * </ul>

 * This order favors a platform defined index over any user defined value.

 */`"${vcap.application.instance_index:${spring.application.index:${server.port:${PORT:null}}}}"`

版本2.0.0.RC1 ContextIdApplicationContextInitializer??赡軙l現索引是自動遞增的 using AtomicLong,這也確保了它的唯一性。有關源代碼中的更多詳細信息,請參閱內部ContextIdApplicationContextInitializer$ContextId類。關鍵方法是它的構造函數:


ContextId createChildId() {

    return new ContextId(this.id + "-" + this.children.incrementAndGet());

}


查看完整回答
反對 回復 2022-11-30
  • 2 回答
  • 0 關注
  • 176 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號