@@ -265,19 +265,20 @@ void before(@Observes BeforeBeanDiscovery discovery) {
265265 // Initialize our implementation
266266 RegistryProducer .clearApplicationRegistry ();
267267
268- // Register beans manually
269- discovery .addAnnotatedType (RegistryProducer .class , "RegistryProducer" );
270- discovery .addAnnotatedType (MetricProducer .class , "MetricProducer" );
271- discovery .addAnnotatedType (InterceptorCounted .class , "InterceptorCounted" );
272- discovery .addAnnotatedType (InterceptorMetered .class , "InterceptorMetered" );
273- discovery .addAnnotatedType (InterceptorTimed .class , "InterceptorTimed" );
274- discovery .addAnnotatedType (InterceptorConcurrentGauge .class , "InterceptorConcurrentGauge" );
275- discovery .addAnnotatedType (InterceptorSimplyTimed .class , InterceptorSimplyTimed .class .getSimpleName ());
268+ // Register beans manually with annotated type identifiers that are deliberately the same as those used by the container
269+ // during bean discovery to avoid accidental duplicate registration in odd packaging scenarios.
270+ discovery .addAnnotatedType (RegistryProducer .class , RegistryProducer .class .getName ());
271+ discovery .addAnnotatedType (MetricProducer .class , MetricProducer .class .getName ());
272+ discovery .addAnnotatedType (InterceptorCounted .class , InterceptorCounted .class .getName ());
273+ discovery .addAnnotatedType (InterceptorMetered .class , InterceptorMetered .class .getName ());
274+ discovery .addAnnotatedType (InterceptorTimed .class , InterceptorTimed .class .getName ());
275+ discovery .addAnnotatedType (InterceptorConcurrentGauge .class , InterceptorConcurrentGauge .class .getName ());
276+ discovery .addAnnotatedType (InterceptorSimplyTimed .class , InterceptorSimplyTimed .class .getName ());
276277
277278 // Telling CDI about our private SyntheticSimplyTimed annotation and its interceptor
278279 // is enough for CDI to intercept invocations of methods so annotated.
279- discovery .addAnnotatedType (InterceptorSyntheticSimplyTimed .class , InterceptorSyntheticSimplyTimed .class .getSimpleName ());
280- discovery .addAnnotatedType (SyntheticSimplyTimed .class , SyntheticSimplyTimed .class .getSimpleName ());
280+ discovery .addAnnotatedType (InterceptorSyntheticSimplyTimed .class , InterceptorSyntheticSimplyTimed .class .getName ());
281+ discovery .addAnnotatedType (SyntheticSimplyTimed .class , SyntheticSimplyTimed .class .getName ());
281282
282283 restEndpointsMetricsEnabled = restEndpointsMetricsEnabled ();
283284 }
0 commit comments