Chapter II: Assembling Beans
--------------------------------------------------------------------------------
1. <ref> tags in the bean, local, parent three properties of the difference (P53)
2. <list><value...</list> and <set><value...</set> can be swapped for list, set and Array property Assignment (P55)
3. <map> properties The key value can only be a string type when loading with spring, but it generally satisfies the requirements (P55)
4. The assembly map attribute is to be key= "Key1" with <entry, while the properties of the Mount property can be written as <prop key= "Key1" >foo</prop>, because the value of properties is always a string, and the map is very casual (P55)
5. Set the property to null with the <property name= "foo" ><null/></property>, the difference being the string "null" (P56)
6. When you inject dependencies through a constructor, you need to specify which parameter to use with the index or type attribute for multiple parameters, and the Index property can handle all cases (P58)
7. You can set Autowire to four values for the Bean, ByName, Bytype, constructor, AutoDetect, four ways to automatically mount, or set the Default-autowire property in <beans>. Manual and automatic can be mixed use, manual priority. You should know what you are doing, so it is not recommended to use automatic assembly (P61)
8. The Beanpostprocessor method postprocessbeforeinitialization called before the Bean is initialized, Postprocessafterinitialization is called after the Bean is initialized, You need to register to beanfactory, such as Factory.addbeanpostprocessor (new Beanpostprocessor () {...}). The built-in applicationcontextawareprocessor is registered on the Abstractapplicationcontext (P64)
9. The beanfactorypostprocessor is processed before the Bean factory is loaded with all the bean definitions and is instantiated. If it is abstractapplicationcontext, then only need to configure <bean id= "Mybeanfactorypostprocessor" class= " Com.unmi.MyBeanFactoryPostProcessor "/>, it will automatically register this, the original beanfactorypostprocessor is not available, no need for a display-style call Addbeanfactorypostprocessor Method (P67)
10. You can load the property file with Propertyplaceholderconfigurer, and then refer to the ${database.url} in other places that reference value (P70)
11. Use Customeditorconfigurer to register your own PropertyEditorSupport the process of associating a particular bean property to find out what Spring has built-in propertyeditorsupport (P72)
Spring is internationalized with Resourcebundlemessagesource, configured as
<bean id= "Messagesource"
class= "Org.springframework.context.support.ResourceBundleMessageSource" >
<property name= "basename" >
<value>trainingtext</value>
</property>
</bean>
<bean id= "Messagesource"
class= "Org.springframework.context.support.ResourceBundleMessageSource" >
<property name= "basename" >
<value>trainingtext</value>
</property>
</bean>
Will read trainingtext.prperties, trainingtext_en_us.properties and so on.
with sring text = Context.getmessage ("Button.submit", new Object[0],locale); or <sping:message code= "Button.submit"/> Read (P73)