The next day of my spring

Source: Internet
Author: User

1. What I learned today is mainly the spring injection method. In addition to the constructor injection, there are also common set injection methods, in the configuration file, the configuration metadata of the set injection mode is <property name = "corresponding to the set method. The words following the set method do not seem to have much to do with the attributes, it is only related to the value after the set of the set Method) "value =" the value injected to the set Method "> </property>.

 

2. Common Property injection includes the basic types of int, String, and lis, map, and set. The basic types of injection are directly as follows: <property name = "setName" value = "injected value"> </property>. The List property injection of the collection type is as follows, <property> <list> <value> value 1 injected into the list set </value> <value> value 2 injected into the list set </value> · </ list> </property>, set injection is the same as list injection. map injection: <property> <map> <entry key = "" value = ""> · </map> </property>.

 

3. spring property Editor: the custom property editor first inherits the PropertyEditorSuppert class provided by spring and overwrites the setAsText () method of this class to define the attributes to be processed in this method. Finally, it needs to be injected into the spring container, that is, configure bean for the custom class.

 

4. Read the configuration file. A single file can directly create a subclass of the beanFactory factory class, for example, new xmlApplicationFactory ("configuration file name"). If there are multiple files, you can use arrays, put the file name in the array, and then read the array, or use a certain rule naming configuration file, and then use the struts2 inside the mode, such as: configuration file 1: beans-editor.xml, file 2: beans-base.xml, then you can write the matching format new xmlApplicationFactory ("beans -*. xml ").

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.