From 31cbb95066409b17815d6c9e2c0c7f6e8da052c0 Mon Sep 17 00:00:00 2001 From: tandraschko Date: Thu, 11 Jan 2024 20:49:17 +0100 Subject: [PATCH] workaround BeanConfigurator --- .../core/util/BeanConfiguratorUtils.java | 18 ++++++++++++++++++ .../impl/PartialBeanBindingExtension.java | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/BeanConfiguratorUtils.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/BeanConfiguratorUtils.java index 8bd42c9c3..7365ef92d 100644 --- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/BeanConfiguratorUtils.java +++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/BeanConfiguratorUtils.java @@ -18,7 +18,9 @@ */ package org.apache.deltaspike.core.util; +import jakarta.enterprise.inject.Any; import jakarta.enterprise.inject.Default; +import jakarta.enterprise.inject.Typed; import jakarta.enterprise.inject.spi.AnnotatedType; import jakarta.enterprise.inject.spi.BeanManager; import jakarta.enterprise.inject.spi.configurator.BeanConfigurator; @@ -72,10 +74,26 @@ else if (beanManager.isStereotype(annotation.annotationType())) } } + if (type.isAnnotationPresent(Typed.class)) + { + Typed typed = type.getAnnotation(Typed.class); + beanConfigurator.types(typed.value()); + } + else + { + for (Class c = type.getJavaClass(); c != Object.class && c != null; c = c.getSuperclass()) + { + beanConfigurator.addTypes(c); + } + beanConfigurator.addTypes(type.getJavaClass().getInterfaces()); + beanConfigurator.addTypes(Object.class); + } + if (!qualifierAdded) { beanConfigurator.addQualifier(Default.Literal.INSTANCE); } + beanConfigurator.addQualifier(Any.Literal.INSTANCE); return beanConfigurator; } diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java index 7c7658070..a06526f0a 100644 --- a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java +++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java @@ -18,7 +18,6 @@ */ package org.apache.deltaspike.partialbean.impl; -import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @@ -41,7 +40,11 @@ import org.apache.deltaspike.core.api.provider.BeanProvider; import org.apache.deltaspike.core.spi.activation.Deactivatable; -import org.apache.deltaspike.core.util.*; +import org.apache.deltaspike.core.util.AnnotationUtils; +import org.apache.deltaspike.core.util.BeanConfiguratorUtils; +import org.apache.deltaspike.core.util.BeanUtils; +import org.apache.deltaspike.core.util.ClassDeactivationUtils; +import org.apache.deltaspike.core.util.ReflectionUtils; import org.apache.deltaspike.partialbean.api.PartialBeanBinding; import org.apache.deltaspike.proxy.api.DeltaSpikeProxyBeanConfigurator;