@EnableConfigurationPropertiesの[春]春アノテーション

、@ EnableConfigurationProperties注釈役割

 豆ができ@ConfigurationProperties注釈をサポート。
   理解するシンプル:@Beanや私たちのクラスのコンフィギュレーションに登録されている他の豆、@EnableConfigurationPropertiesコンフィギュレーションクラスを通じてビーンコンテナをコメントするレジスタ注釈されないことがあります。
 
第二に、例の使用はEnableConfigurationProperties @ノート
例RedisAutoConfigurationクラスの場合、あなたはRedisPropertiesの設定クラスを登録する必要がありますこの方法です。
@Configuration 
@ConditionalOnClass(RedisOperations。クラス@EnableConfigurationProperties(RedisProperties。クラス 
@import({LettuceConnectionConfiguration。クラス、JedisConnectionConfiguration。クラス})
 パブリック クラスRedisAutoConfiguration { 
 ... 
}
RedisProperties @Componentプラスクラスの他の注釈は、Springコンテナに登録することはできません
@ConfigurationProperties(接頭辞= "spring.redis" パブリック クラスRedisProperties { 
... 
}

 

おすすめ

転載: www.cnblogs.com/756623607-zhang/p/11427112.html