3.11 Dependency Check

Spring has 4 different validation modes to check if properties have been on a bean. The different dependency check modes are 'none', 'simple', 'object', and 'all'. The default mode is 'none', so there isn't any dependency check validation unless explicitly configured. All values being checked must have been set in the configuration file or by autowiring. If a class has any defaults or fields that don't need to be set, the dependency check modes won't be of any use.

Table 3.3. Dependency Check Types

Dependency Check ModeDescription
noneNo dependency checking. This is the default
simpleDependency check for primitives and collections.
objectDependency check for beans (collaborators).
allDependency check for primitives, collections, and beans (collaborators).


The 'simple' mode checks that all primitive and collection values have been set. The 'object' mode checks that all collaborators (objects) have been set. The 'all' mode checks for everything that the 'simple' and 'object' modes do. Also, the root beans element has a default-dependency-check attribute to change the default mode for all beans in the configuration file.