We do something like this by bean switching using properties from a properties file loaded using a PropertyPlaceholderConfigurer. Using your example, this would look like:
Code:
<beans>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:your.properties</value>
</list>
</property>
</bean>
<bean id="eventManager"
class="org.springframework.beans.factory.config.BeanReferenceFactoryBean">
<property name="targetBeanName">
<value>eventManager${event.manager}</value>
</property>
</bean>
<bean id="eventManagerReal" class="EventManager" lazy="true"/>
<bean id="eventManagerNull" class="" lazy="true"/>
</beans>
Now in your property file you can set:
for the null event manager or:
for the real one. You can configure the property placeholder configurer so that you can override properties using system properties, so you could switch beans using a -Devent.manager=Null on the command line.