docs/Spring全家桶/Spring/Spring中的配置元数据(管理配置的基本数据).md
Bean ԪϢ - BeanDefinition
Spring XML ԪϢ - beans Ԫ
| beans Ԫ | Ĭֵ | ʹó |
|---|---|---|
| profile | nullգ | Spring Profiles ֵ |
| default-lazy-init | default | outter beans default-lazy-init Դʱ̳иֵΪfalse |
| default-merge | default | outter beans default-merge Դʱ̳иֵΪfalse |
| default-autowire | default | outter beans default-autowire Դʱ̳иֵΪno |
| default-autowire-candidates | nullգ | Ĭ Spring Beans pattern |
| default-init-method | nullգ | Ĭ Spring Beans Զʼ |
| default-destroy-method | nullգ | Ĭ Spring Beans Զٷ |
Spring XML ԪϢ - Ӧ
| XML Ԫ | ʹó |
|---|---|
<context:annotation-config /> | Spring ע |
<context:component-scan /> | Spring @Component ԼԶעɨ |
<context:load-time-weaver /> | Spring LoadTimeWeaver |
<context:mbean-export /> | ¶ Spring Beans Ϊ JMX Beans |
<context:mbean-server /> | ǰƽ̨Ϊ MBeanServer |
<context:property-placeholder /> | ⲿԴΪ Spring |
<context:property-override /> | ⲿԴ Spring |
ײʵ - XmlBeanDefinitionReader
| XML Ԫ | ʹó |
|---|---|
<beans:beans /> | XML ԴµĶ Spring Beans |
<beans:bean /> | Spring Bean 壨BeanDefinition |
<beans:alias /> | Ϊ Spring Bean 壨BeanDefinitionӳ |
<beans:import /> | ⲿ Spring XML Դ |
ײʵ - PropertiesBeanDefinitionReader
| Properties | ʹó |
|---|---|
class | Bean ȫ |
abstract | ǷΪ BeanDefinition |
parent | ָ parent BeanDefinition |
lazy-init | ǷΪӳٳʼ |
ref | Bean |
scope | Bean scope |
| ${n} | n ʾ n+1 |
Spring ģʽע
| Spring ע | ˵ | ʼ汾 |
|---|---|---|
@Repository | ݲִģʽע | 2.0 |
@Component | ͨģʽע | 2.5 |
@Service | ģʽע | 2.5 |
@Controller | Web ģʽע | 2.5 |
@Configuration | ģʽע | 3.0 |
Spring Bean ע
| Spring ע | ˵ | ʼ汾 |
|---|---|---|
@Bean | 滻 XML Ԫ <bean> | 3.0 |
@DependsOn | XML <bean depends-on="..."/> | 3.0 |
@Lazy | XML `<bean lazy-init="true | falses" />` |
@Primary | 滻 XML Ԫ `<bean primary="true | false" />` |
@Role | 滻 XML Ԫ <bean role="..." /> | 3.1 |
@Lookup | XML <bean lookup-method="..."> | 4.1 |
Spring Bean עע
| Spring ע | ˵ | ʼ汾 |
|---|---|---|
@Autowired | Bean ע룬ֶ֧ҷʽ | 2.5 |
@Qualifier | ϸȵ @Autowired | 2.5 |
| Java ע | ˵ | ʼ汾 |
|---|---|---|
| @Resource | @Autowired | 2.5 |
| @Inject | @Autowired | 2.5 |
Spring Bean װע
| Spring ע | ˵ | ʼ汾 |
|---|---|---|
| @Profile | ûװ | 3.1 |
| @Conditional | װ | 4.0 |
Spring Bean ڻصע
| Spring ע | ˵ | ʼ汾 |
|---|---|---|
| @PostConstruct | 滻 XML Ԫ <bean init-method="..."></bean> InitializingBean | 2.5 |
| @PreDestroy | 滻 XML Ԫ <bean destroy-method="..."></bean> DisposableBean | 2.5 |
Spring BeanDefinition ע
| Spring ע | ˵ | ʼ汾 |
|---|---|---|
| XML Դ | XmlBeanDefinitionReader | 1.0 |
| Properties Դ | PropertiesBeanDefinitionReader | 1.0 |
| Java ע | AnnotatedBeanDefinitionReader | 3.0 |
API - XmlBeanDefinitionReader
API - PropertiesBeanDefinitionReader
API - AnnotatedBeanDefinitionReader
Spring IoC XML
| ռ | ģ | Schema Դ URL |
|---|---|---|
| beans | spring-beans | https://www.springframework.org/schema/beans/spring-beans.xsd |
| context | spring-context | https://www.springframework.org/schema/context/spring-context.xsd |
| aop | spring-aop | https://www.springframework.org/schema/aop/spring-aop.xsd |
| tx | spring-tx | https://www.springframework.org/schema/tx/spring-tx.xsd |
| util | spring-beans | beans https://www.springframework.org/schema/util/spring-util.xsd |
| tool | spring-beans | https://www.springframework.org/schema/tool/spring-tool.xsd |
Spring IoC װע
| Spring ע | ˵ | ʼ汾 |
|---|---|---|
| @ImportResource | 滻 XML Ԫ <import> | 3.0 |
| @Import | Configuration Class | 3.0 |
| @ComponentScan | ɨָ package ±ע Spring ģʽע | 3.1 |
Spring IoC ע
| Spring ע | ˵ | ʼ汾 |
|---|---|---|
| @PropertySource | Գ PropertySource ע | 3.1 |
| @PropertySources | @PropertySource ע | 4.0 |
Spring XML չ
BeanDefinitionParserDelegate#parseCustomElement(org.w3c.dom.Element, BeanDefinition)
ע
API
API
Spring Ƚ XML Schema Щ
| ռ | ģ | Schema Դ URL |
|---|---|---|
| beans | spring-beans | https://www.springframework.org/schema/beans/spring-beans.xsd |
| context | spring-context | https://www.springframework.org/schema/context/spring-context.xsd |
| aop | spring-aop | https://www.springframework.org/schema/aop/spring-aop.xsd |
| tx | spring-tx | https://www.springframework.org/schema/tx/spring-tx.xsd |
| util | spring-beans | beans https://www.springframework.org/schema/util/spring-util.xsd |
| tool | spring-beans | https://www.springframework.org/schema/tool/spring-tool.xsd |
Spring ԪϢЩ
Extensible XML authoring ȱ
https://www.w3cschool.cn/wkspring https://www.runoob.com/w3cnote/basic-knowledge-summary-of-spring.html http://codepub.cn/2015/06/21/Basic-knowledge-summary-of-Spring https://dunwu.github.io/spring-tutorial https://mszlu.com/java/spring http://c.biancheng.net/spring/aop-module.html