Spring PropertiesPropertySource

  • Author: HuiFer
  • 源码阅读仓库: SourceHot-spring

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

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

  • getPropertyNames 就转换成了父类 MapPropertySource 的方法了
    • map.keySet()
  1. public class PropertiesPropertySource extends MapPropertySource {
  2. @SuppressWarnings({"rawtypes", "unchecked"})
  3. public PropertiesPropertySource(String name, Properties source) {
  4. super(name, (Map) source);
  5. }
  6. protected PropertiesPropertySource(String name, Map<String, Object> source) {
  7. super(name, source);
  8. }
  9. @Override
  10. public String[] getPropertyNames() {
  11. synchronized (this.source) {
  12. return super.getPropertyNames();
  13. }
  14. }
  15. }