Spring StubPropertySource

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

  • 整体代码如下.

    • 通过 StubPropertySource 的 getProperty 方法永远返回 null
  1. public static class StubPropertySource extends PropertySource<Object> {
  2. public StubPropertySource(String name) {
  3. super(name, new Object());
  4. }
  5. /**
  6. * Always returns {@code null}.
  7. */
  8. @Override
  9. @Nullable
  10. public String getProperty(String name) {
  11. return null;
  12. }
  13. }