Spring, archetypes, conditional sections, and properties.

Comment on Project Configuration with Spring

We added a further twist to the properties and added "conditional sections" to the contexts.
For properties, we have the normal "common" properties that define the default values for all properties for all deployments, deployment specific properties that override the defaults, and archetype specific properties that (mostly) enable conditional sections. Examples of archetypes are "full text search", "full text indexing", "analytics processing", "upload processing", etc.

The conditional sections allow for the inclusion of beans based on the value of a property. We have many properties that have names of the form "xxxx.enabled". When the value is "true" then the conditional section's beans are defined. (A similar effect can be had by using different "application" context files but we found that conditional sections worked better for us.)

The startup procedure is to
  1. load the common properties to "prime" the environment,
  2. load the deployment specific properties where are defined the archetypes used by the deployment,
  3. load each of the archetype properties, and then, finally,
  4. reload the deployment specific properties again (to reset deployment specific property values).
Together these two features -- conditionals and archetypes -- allows us to deploy a specific configuration with very little customization. And it is all done within Spring with just two custom tags.




Another amazing animation by Piotr Kaczmarek!

Another amazing animation by Piotr Kaczmarek!