You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
source-code-hunter/docs/Spring/clazz/PropertySource/Spring-ServletConfigPropert...

36 lines
897 B

# Spring ServletConfigPropertySource
- Author: [HuiFer](https://github.com/huifer)
- 源码阅读仓库: [SourceHot-spring](https://github.com/SourceHot/spring-framework-read)
- 类全路径: `org.springframework.web.context.support.ServletConfigPropertySource`
- 内部数据结构是 `ServletConfig`
- 整体代码如下
```java
public class ServletConfigPropertySource extends EnumerablePropertySource<ServletConfig> {
public ServletConfigPropertySource(String name, ServletConfig servletConfig) {
super(name, servletConfig);
}
@Override
public String[] getPropertyNames() {
// javax.servlet.ServletConfig.getInitParameterNames
return StringUtils.toStringArray(this.source.getInitParameterNames());
}
@Override
@Nullable
public String getProperty(String name) {
// javax.servlet.ServletConfig.getInitParameter
return this.source.getInitParameter(name);
}
}
```