diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeanBuildItem.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeanBuildItem.java index 442dfd08b07280..3a8dd22f6fb184 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeanBuildItem.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeanBuildItem.java @@ -193,6 +193,10 @@ Set getQualifiers() { return qualifiers; } + String getIdentifier() { + return identifier; + } + Supplier getSupplier() { return supplier; } diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeansProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeansProcessor.java index 747580b6728efa..0c105be1d1af35 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeansProcessor.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeansProcessor.java @@ -94,7 +94,8 @@ private void configureSyntheticBean(ArcRecorder recorder, private String createName(ExtendedBeanConfigurator configurator) { return configurator.getImplClazz().toString().replace(".", "_") + "_" - + HashUtil.sha1(configurator.getTypes().toString() + configurator.getQualifiers().toString()); + + HashUtil.sha1(configurator.getTypes().toString() + configurator.getQualifiers().toString() + + (configurator.getIdentifier() != null ? configurator.getIdentifier() : "")); } private Consumer creator(String name, SyntheticBeanBuildItem bean) { diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/synthetic/SyntheticBeanBuildItemProxyTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/synthetic/SyntheticBeanBuildItemProxyTest.java index 6ce4b6c9d54771..2186b1e1faabfc 100644 --- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/synthetic/SyntheticBeanBuildItemProxyTest.java +++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/synthetic/SyntheticBeanBuildItemProxyTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.lang.reflect.Method; import java.util.List; @@ -98,10 +98,20 @@ public SynthBean test(String val) { public void testBeans() { List> beans = Arc.container().listAll(SynthBean.class); assertEquals(2, beans.size()); + int countOk = 0; + int countNok = 0; for (InstanceHandle handle : beans) { String val = handle.get().getValue(); - assertTrue("ok".equals(val) || "nok".equals(val)); + if ("ok".equals(val)) { + countOk++; + } else if ("nok".equals(val)) { + countNok++; + } else { + fail("Expected 'ok' or 'nok'"); + } } + assertEquals(1, countOk); + assertEquals(1, countNok); } @Vetoed