source-code-hunter/docs/Spring/clazz/PropertySource/Spring-StubPropertySource.md
2020-10-20 11:33:39 +00:00

563 B

Spring StubPropertySource

  • Author: HuiFer

  • 源码阅读仓库: SourceHot-spring

  • 整体代码如下.

    • 通过 StubPropertySource 的 getProperty 方法永远返回 null
	public static class StubPropertySource extends PropertySource<Object> {

		public StubPropertySource(String name) {
			super(name, new Object());
		}

		/**
		 * Always returns {@code null}.
		 */
		@Override
		@Nullable
		public String getProperty(String name) {
			return null;
		}
	}