准备工作
示例代码:
@Componentpublic class Foo {@Value("${foo.bar}")private String bar;public String getBar() {return bar;}public void setBar(String bar) {this.bar = bar;}@Overridepublic String toString() {return "Foo{" +"bar='" + bar + '\'' +'}';}}
配置项:
foo.bar=baz
在什么阶段进行 @Value 中的占位符替换?
AutowiredAnnotationBeanPostProcessor:负责处理 @Value 标注的字段。
BeanPostProcessor implementation that autowires annotated fields, setter methods, and arbitrary config methods. Such members to be injected are detected through annotations: by default, Spring’s @Autowired and @Value annotations.
AbstractBeanFactory中的 embeddedValueResolvers 在什么时候被赋值?赋什么值?
配置项加载后保存在哪里?由谁从配置项中找到占位符对应的配置项?
怎么自定义加载来自外部的配置?比如来自网络。
jasypt的实现原理是什么?
PropertySources 的顺序导致某些取值不符合期望
PropertySource 的内部实现是使用了 Environment,那么 Environment 中的配置项是从哪里来的?
