Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 884 Bytes

Spring-PropertiesPropertySource.md

File metadata and controls

33 lines (24 loc) · 884 Bytes

Spring PropertiesPropertySource

  • Author: HuiFer

  • 源码阅读仓库: SourceHot-spring

  • 全路径: org.springframework.core.env.PropertiesPropertySource

  • Properties 是 map 结构。可以做类型转换.

  • getPropertyNames 就转换成了父类 MapPropertySource 的方法了

    • map.keySet()
public class PropertiesPropertySource extends MapPropertySource {

   @SuppressWarnings({"rawtypes", "unchecked"})
   public PropertiesPropertySource(String name, Properties source) {
      super(name, (Map) source);
   }

   protected PropertiesPropertySource(String name, Map<String, Object> source) {
      super(name, source);
   }


   @Override
   public String[] getPropertyNames() {
      synchronized (this.source) {
         return super.getPropertyNames();
      }
   }

}