Spring bean parse
BeanDefinitionParserDelegate parses the content in <bean id = "" name = "" name ". You can use", ",": ", and" "as the separator. If the id is empty, assign the first value in name to id Entry --> BeanEntrypublic final class ParseState {/*** Tab character used when rendering the tree-style representation. */private static final char TAB = '\ T';/*** Internal {@ link Stack} storage. */private final Stack <Entry> state;/*** Create a new {@ code ParseState} with an empty {@ link Stack }. */Public ParseState () {this. state = new Stack <Entry> ();} /*** Create a new {@ code ParseState} whose {@ link Stack} is a {@ link Object # clone} * of that of the passed in {@ code ParseState}. * // @ SuppressWarnings ("unchecked") private ParseState (ParseState other) {this. state = (Stack <Entry>) other. state. clone ();}/*** Add a new {@ link Entry} to the {@ link Stack }. */public void push (Entr Y entry) {this. state. push (entry);}/*** Remove an {@ link Entry} from the {@ link Stack }. */public void pop () {this. state. pop ();} /*** Return the {@ link Entry} currently at the top of the {@ link Stack} or * {@ code null} if the {@ link Stack} is empty. */public Entry peek () {return this. state. empty ()? Null: this. state. peek ();}/*** Create a new instance of {@ link ParseState} which is an independent snapshot * of this instance. */public ParseState snapshot () {return new ParseState (this);}/*** Returns a tree-style representation of the current {@ code ParseState }. * // @ Override public String toString () {StringBuilder sb = new StringBuilder (); for (int x = 0; x <this. state. size (); x ++) {I F (x> 0) {sb. append ('\ n'); for (int y = 0; y <x; y ++) {sb. append (TAB);} sb. append ("->");} sb. append (this. state. get (x);} return sb. toString ();}/*** Marker interface for entries into the {@ link ParseState }. */public interface Entry {} public class BeanEntry implements ParseState. entry {private String beanDefinitionName;/*** Creates a new instance of {@ link BeanEntry} class. * @ par Am beanDefinitionName the name of the associated bean definition */public BeanEntry (String beanDefinitionName) {this. beanDefinitionName = beanDefinitionName;} @ Override public String toString () {return "Bean" + this. beanDefinitionName + "'" ;}} BeanDefinition instance: GenericBeanDefinition bd = new GenericBeanDefinition (); AbstractBeanDefinition --> BeanMetadataAttributeAccessor public class BeanMet AdataAttributeAccessor extends AttributeAccessorSupport implements BeanMetadataElement {private Object source ;........} public abstract class AttributeAccessorSupport implements AttributeAccessor, Serializable {/** Map with String keys and Object values */private final Map <String, Object> attributes = new LinkedHashMap <String, object> (0 );....} beanMetadataAttribute attribute: public class BeanM EtadataAttribute implements BeanMetadataElement {private final String name; private final Object value; private Object source;} LookupOverride: public class LookupOverride extends MethodOverride {private final String beanName; private Method method ;.......} public abstract class MethodOverride implements BeanMetadataElement {private final String methodName; private boolean overloaded = true; pr Ivate Object source ;...........} public class MethodOverrides {private final Set <MethodOverride> overrides = new javashashset <MethodOverride> (0 );......} replaceOverride: public class ReplaceOverride extends MethodOverride {private final String methodReplacerBeanName; private List <String> typeIdentifiers = new inclulist <String> ();.....} Constructor-arg: only one sub-element (must not contain more than one sub-element) is only allowed to contain either 'ref 'attribute OR 'value' attribute OR sub-element ref is converted to RuntimeBeanReferencepublic class RuntimeBeanReference implements BeanReference {private final String beanName; private final boolean toParent; private Object source ;....} If value is used as an attribute, it is converted to: public class TypedStringValue implements BeanMetadataElement {private String value; private volatile Object targetType; private Object source; private String specifiedTypeName; private volatile boolean dynamic ;.....} Constructor parses the objects stored: public class ConstructorArgumentValues {private final Map <Integer, ValueHolder> indexedArgumentValues = new LinkedHashMap <Integer, ValueHolder> (0 ); private final List <ValueHolder> genericArgumentValues = new registrant List <ValueHolder> ();....} Corresponding to <constructor index .... use indexedArgumentValues to store data without indexes use genericArgumentValues to store Property resolution: public class PropertyValue extends implements Serializable {private final String name; private final Object value; private Object source; private boolean optional = false; private boolean converted = false; private Object convertedValue;/** Package-visible field that indicates whether conversion is necessary */volatile Boolean conversionNecessary; /** Package-visible field for caching the resolved property path tokens */transient volatile Object resolvedTokens ;.......} the value Type in PropertyValue is ManagedList public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccessor implements BeanDefinition, Cloneable {......... private MutablePropertyValues propertyValues ;.........} parsing the Qualifier sub-element as the attribute for storing default elements: public class AutowireCandidateQualifier extends BeanMetadataAttributeAccessor {public static String VALUE_KEY = "value"; private final String typeName ;......} public class BeanMetadataAttributeAccessor extends AttributeAccessorSupport implements BeanMetadataElement {private Object source ;..............} public abstract class AttributeAccessorSupport implements AttributeAccessor, Serializable {/** Map with String keys and Object values */private final Map <String, Object> attributes = new LinkedHashMap <String, object> (0 );........}