INT-3896: JMX: Fix Double Router MBean Export

JIRA: https://jira.spring.io/browse/INT-3896

Routers created by the `RouterFactoryBean` were not suppressed from being exported
by the context exporter when an `IMBE` is present.

Move the suppression logic to `postProcessAfterInitialization()` so the annotation on
the bean created by the factory bean is detected. The annotation is not detected on
the factory bean itself in `postProcessBeforeInitialization()`.
This commit is contained in:
Gary Russell
2015-11-21 13:02:50 -05:00
parent b621417380
commit fc0af2fed6
2 changed files with 9 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@@ -90,6 +90,9 @@ public class RouterMBeanTests {
// System.err.println(server.queryNames(new ObjectName("*:type=MessageHandler,*"), null));
Set<ObjectName> names = server.queryNames(new ObjectName("test.RouterMBean:type=MessageHandler,name=ptRouter,*"), null);
assertEquals(1, names.size());
// INT-3896
names = server.queryNames(new ObjectName("test.RouterMBean:type=ExpressionEvaluatingRouter,*"), null);
assertEquals(0, names.size());
}
public static interface Service {