From: http://jnotnull.iteye.com/blog/153475
In the preceding example, we can see that an error is thrown if no matching is found by setting the dependency-check = "object" attribute. This is the type check.
Let's take a look at the dependency Check Mode in bean 4 in Spring: simple, object, all, none.
1 simple: Check the dependency of the basic type, struct type, and set.
Java code
- <? XML version = "1.0" encoding = "UTF-8"?>
- <! Doctype beans public "-// spring // DTD bean // en"
- Http://www.springframework.org/dtd/spring-beans.dtd>
- <Beans>
- <Bean id = "helloworld" class = "com. jnotnull. helloworld"
- Autowire = "autodectect" dependency-check = "simple">
- <Bean>
- <Bean id = "date" class = "Java. util. Date">
- </Beans>
2 object: Check the Java code of the dependent object
- <? XML version = "1.0" encoding = "UTF-8"?>
- <! Doctype beans public "-// spring // DTD bean // en"
- Http://www.springframework.org/dtd/spring-beans.dtd>
- <Beans>
- <Bean id = "helloworld" class = "com. jnotnull. helloworld"
- Autowire = "autodectect" dependency-check = "object">
- <Bean>
- <Bean id = "date" class = "Java. util. Date">
- </Beans>
3 All: Check all attributes in Java code
- <? XML version = "1.0" encoding = "UTF-8"?>
- <! Doctype beans public "-// spring // DTD bean // en"
- Http://www.springframework.org/dtd/spring-beans.dtd>
- <Beans>
- <Bean id = "helloworld" class = "com. jnotnull. helloworld"
- Autowire = "autodectect" dependency-check = "all">
- <Bean>
- <Bean id = "date" class = "Java. util. Date">
- </Beans>
4 none: no dependency check: Java code
- <? XML version = "1.0" encoding = "UTF-8"?>
- <! Doctype beans public "-// spring // DTD bean // en"
- Http://www.springframework.org/dtd/spring-beans.dtd>
- <Beans>
- <Bean id = "helloworld" class = "com. jnotnull. helloworld"
- Autowire = "autodectect" dependency-check = "NONE">
- <Bean>
- <Bean id = "date" class = "Java. util. Date">
- </Beans>
From this we can see that dependency check is generally used together with automatic loading. If there is no automatic load, there is no need for dependency check.