Hi:
I'm writing a test for my fault management code and want to add a notification listener in my test. I have my regular applicationContext.xml and a testContext.xml. In applicationContext.xml I'm using the <context:*> tags to declare my mbean server and exporter. My MBeans are annotated. In my testContext.xml I want to add a listener. So I declared another AnnotationMBeanExporter and set the server property to ref the mbean server from applicationContext.xml. Here are two files

Code:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:mbean-server id="mbeanServer" />
    <context:component-scan base-package="my.package" />
    <context:mbean-export server="mbeanServer" registration="replaceExisting" />

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreResourceNotFound" value="true" />
        <property name="locations">
            <list>
                <value>classpath:fm.properties</value>
            </list>
        </property>
    </bean>

</beans>
Code:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <bean class="org.springframework.jmx.export.annotation.AnnotationMBeanExporter">
        <property name="server" ref="mbeanServer" />
        <property name="registrationBehaviorName" value="REGISTRATION_IGNORE_EXISTING" />
        <property name="notificationListenerMappings">
            <map>
                <entry key="*">
                    <bean class="my.package.CountingNotificationListener" />
                </entry>
            </map>
        </property>
    </bean>

</beans>
This didn't work. However, I was able to successfully add the listener in my test using the following code.
Code:
    @Autowired
    // applicationContext.xml mbeanExporter
    private MBeanExporter mBeanExporter;
    @Autowired
    private CountingNotificationListener listener;

    @Before
    public void init()
    {
        Map<String, NotificationListener> listeners = new HashMap<String, NotificationListener>();
        listeners.put("*", listener);
        mBeanExporter.setNotificationListenerMappings(listeners);
        mBeanExporter.afterPropertiesSet();
    }
Is it possible to do this through configuration, without code? If so, what am I missing? I thought that if two mbean exporters used the mbean server then listeners could be on either mbean exporter.

Thanks in advance.