Dependency Checking in spring

Source: Internet
Author: User

4 dependent check supported modes:
    • None – does not rely on check, which is the default mode.
    • simple– if the base type (int, long,double ...) and collection type (map, list..) Any of the properties are not set, Unsatisfieddependencyexception will be thrown.
    • objects– if any property of the object type is not set, Unsatisfieddependencyexception will be thrown.
    • all– if any of the properties of any type are not set, Unsatisfieddependencyexception will be thrown.

Note: The default mode is None

None

<bean id= "obj" class= "Com.xuzhiwen.spring9.Object1" dependency-check= "None">        <property name= "Name" value= "Tom" /></bean>

Simple

<bean id= "obj" class= "Com.xuzhiwen.spring9.Object1" dependency-check= "simple">        <property Name = "name" value= "Tom" /></bean>

Objects

<bean id= "obj" class= "Com.xuzhiwen.spring9.Object1" dependency-check= "Objects">        <property Name = "name" value= "Tom" /></bean>

All

<bean id= "obj" class= "Com.xuzhiwen.spring9.Object1" dependency-check= "All">        <property name= " Name "value=" Tom " /></bean>

Global Default Dependency check:

<beans xmlns= "Http://www.springframework.org/schema/beans"    xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance "    xmlns:p=" http://www.springframework.org/schema/p "    xsi:schemalocation = "Http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/ Spring-beans-2.5.xsd"    default-dependency-check=" All ">

</beans>

Dependency Checking in spring

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.