As for me, this problem can be solved by using Spring 3.1 @Profiles, because @Conditional annotation give you opportunity for define some strategy for conditional bean registration (user-defined strategies for conditional checking), when @Profiles can based logic only on Environment variables only.