From f4596591e4d7ab6b9a159cf3746c4254e1feacab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 6 Nov 2024 09:08:06 +0100 Subject: [PATCH] Do not try to list synthetic injection points in "inactive bean" errors Attempting to list them results in an error message such as: ``` 04:07:27,906 INFO [app] Caused by: io.quarkus.runtime.configuration.ConfigurationException: Unable to find datasource '' for persistence unit 'default-reactive': Bean is not active: SYNTHETIC bean [class=io.vertx.pgclient.PgPool, id=WVL9cdM2vfa8AHSEpmajClhheoQ] 04:07:27,906 INFO [app] Reason: Datasource '' was deactivated automatically because its URL is not set. To activate the datasource, set configuration property 'quarkus.datasource.reactive.url'. Refer to https://quarkus.io/guides/datasource for guidance. 04:07:27,906 INFO [app] To avoid this exception while keeping the bean inactive: 04:07:27,906 INFO [app] - Configure all extensions consuming this bean as inactive as well, if they allow it, e.g. 'quarkus.someextension.active=false' 04:07:27,906 INFO [app] - Make sure that custom code only accesses this bean if it is active 04:07:27,907 INFO [app] - Inject the bean with 'Instance' instead of 'io.vertx.pgclient.PgPool' 04:07:27,907 INFO [app] This bean is injected into: 04:07:27,907 INFO [app] - 04:07:27,907 INFO [app] at io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil.unableToFindDataSource(PersistenceUnitUtil.java:115) ``` See the empty list item after "This bean is injected into"? --- .../src/main/java/io/quarkus/arc/processor/BeanGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java index 6d839c1277323..1a1355759037d 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java @@ -1100,7 +1100,7 @@ private void implementCreateForSyntheticBean(ClassCreator beanCreator, BeanInfo List matchingIPs = new ArrayList<>(); for (InjectionPointInfo injectionPoint : bean.getDeployment().getInjectionPoints()) { - if (bean.equals(injectionPoint.getResolvedBean())) { + if (!injectionPoint.isSynthetic() && bean.equals(injectionPoint.getResolvedBean())) { matchingIPs.add(injectionPoint); } }