We all find ourselves finding solutions to the problem of loading different configurations depending on the environment.

The basic ones are which database to connect to depending if we are in production or testing. 

The options are very large, and the solutions many.

Spring now has the option to add an attribute to each bean with a profile, and then you load the context depending on the profile. This will allow you by one flag to define which beans will be loaded when.

 

For  more information see this nice blog: