Skip to content

Commit

Permalink
workaround BeanConfigurator
Browse files Browse the repository at this point in the history
  • Loading branch information
tandraschko committed Jan 11, 2024
1 parent f883d7b commit 31cbb95
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 31cbb95

Please sign in to comment.