Bean

What

@Bean注解用于标记一个Method产生BeanDefinition

Usage

How

Retrieve Bean Method

doProcessConfigurationClass()方法中,有一段检索BeanMethod的代码片段:

// Process individual @Bean methods
Set<MethodMetadata> beanMethods = retrieveBeanMethodMetadata(sourceClass);
for (MethodMetadata methodMetadata : beanMethods) {
	configClass.addBeanMethod(new BeanMethod(methodMetadata, configClass));
}

Load

loadBeanDefinitionsForBeanMethod()中加载BeanDefinition