Summary of Spring Bean properties and child elements usage2016-08-03 00:0097 people readComments (0)CollectionReport Category:Spring&springmvc
(+)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Spring framework mainly has four kinds of tag beans, alias, import, beans, where the bean tag is the basis of other tags, this article mainly on the Bean tag properties and their child elements of the discussion, not much nonsense, please look down.
The attributes of the bean tag
1) Scope: The scope used to configure the spring bean
2) Singleton: Indicates that the Bean is a singleton
3) Abstract: Set to True to use the bean only as a template, the application context does not attempt to initialize it beforehand
4) Lazy-init: Set to True, lazy loading, the bean will not be instantiated in advance of ApplicationContext startup, but rather the first time it is instantiated to the container through Getbean request Bean
Note: only works with singleton beans
5) Autowire: Automatic assembly
6) Dependency-check: Dependency Check
7) Depends-on: Indicates that instantiation of one bean relies on another bean to instantiate first
8) Autowire-candidate: Set to False, the container will not consider the bean when it looks for an automatic assembly object, that is, it will not be considered as a candidate for automatic assembly of other beans, but the bean itself can use automatic assembly to inject other beans
9) Primary: The Bean is first injected
Init-method: The method that is called when the Bean is initialized
Destory-method: The method that was called before the container was destroyed
Factory-method: The bean is only started to be instantiated when the method pointed to by Factory-method is called
Factory-bean: Create a bean in a way that calls the static factory method
Second, the child element of the bean
1) Meta: Meta data, when needed to use the information inside can be obtained by key
2) Lookup-method: The fetch is injected to declare a method to return some type of bean but the actual bean to be returned is configured in the configuration file.
3) Replaced-method: The new method can be called at runtime to replace the existing method, and the logic of the old method can be updated dynamically
4) Constructor-arg: The bean is automatically searched for the corresponding constructor, and when initialized, the parameters are passed in.
5) Property: Basic Data type Assignment
6) Qualifier: Specify the name of the injected bean by qualifier
Source: >
From for notes (Wiz)
Summary of Spring Bean properties and child elements usage