Spring ServletContextPropertySource

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

  • 类全路径: org.springframework.web.context.support.ServletContextPropertySource

  • 内部数据结构是 ServletContext 接口
  • 整体代码如下.
  1. public class ServletContextPropertySource extends EnumerablePropertySource<ServletContext> {
  2. public ServletContextPropertySource(String name, ServletContext servletContext) {
  3. super(name, servletContext);
  4. }
  5. @Override
  6. public String[] getPropertyNames() {
  7. // javax.servlet.ServletContext.getInitParameterNames 方法调用
  8. return StringUtils.toStringArray(this.source.getInitParameterNames());
  9. }
  10. @Override
  11. @Nullable
  12. public String getProperty(String name) {
  13. // javax.servlet.ServletContext.getInitParameter
  14. return this.source.getInitParameter(name);
  15. }
  16. }