Class UnremovableBeanBuildItem

java.lang.Object
io.quarkus.builder.item.BuildItem
io.quarkus.builder.item.MultiBuildItem
io.quarkus.arc.deployment.UnremovableBeanBuildItem

public final class UnremovableBeanBuildItem extends io.quarkus.builder.item.MultiBuildItem
This build item is used to exclude beans that would be normally removed if the config property ArcConfig.removeUnusedBeans() is set to true.

Consider using one of the convenient static factory methods such as beanTypes(Class...):

 @BuildStep
 UnremovableBeanBuildItem unremovable() {
     // Any bean that has MyService in its set of bean types is considered unremovable
     return UnremovableBeanBuildItem.beanTypes(MyService.class);
 }
 
Alternatively, you could make use of the pre-built predicate classes such as UnremovableBeanBuildItem.BeanClassNameExclusion:
 @BuildStep
 UnremovableBeanBuildItem unremovable() {
     // A bean whose bean class FQCN is equal to org.acme.MyService is considered unremovable
     return new UnremovableBeanBuildItem(new BeanClassNameExclusion("org.acme.MyService"));
 }
 
  • Constructor Details

  • Method Details

    • getPredicate

      public Predicate<BeanInfo> getPredicate()
    • getClassNames

      public Set<String> getClassNames()
    • beanClassNames

      @CheckReturnValue public static UnremovableBeanBuildItem beanClassNames(String... classNames)
      Match beans whose bean class matches any of the specified class names.
      Parameters:
      classNames -
      Returns:
      a new build item
    • beanClassNames

      @CheckReturnValue public static UnremovableBeanBuildItem beanClassNames(Set<String> classNames)
      Match beans whose bean class matches any of the specified class names.
      Parameters:
      classNames -
      Returns:
      a new build item
    • beanTypes

      @CheckReturnValue public static UnremovableBeanBuildItem beanTypes(org.jboss.jandex.DotName... typeNames)
      Match beans which have any of the specified type names in its set of bean types.
      Parameters:
      typeNames -
      Returns:
      a new build item
    • beanTypes

      @CheckReturnValue public static UnremovableBeanBuildItem beanTypes(Class<?>... types)
      Match beans which have any of the specified type names in its set of bean types.
      Parameters:
      typeNames -
      Returns:
      a new build item
    • beanTypes

      @CheckReturnValue public static UnremovableBeanBuildItem beanTypes(Set<org.jboss.jandex.DotName> typeNames)
      Match beans which have any of the specified type names in its set of bean types.
      Parameters:
      typeNames -
      Returns:
      a new build item
    • beanClassAnnotation

      @CheckReturnValue public static UnremovableBeanBuildItem beanClassAnnotation(org.jboss.jandex.DotName annotationName)
      Match class beans whose target class contains the specified annotation.

      The annotations can be declared on the class, and every nested element of the class (fields, types, methods, etc).

      Parameters:
      annotationName -
      Returns:
      a new build item
    • beanClassAnnotation

      @CheckReturnValue public static UnremovableBeanBuildItem beanClassAnnotation(String nameStartsWith)
      Match class beans whose target class contains an annotation whose name starts with the specified value.

      The annotations can be declared on the class, and every nested element of the class (fields, types, methods, etc).

      Parameters:
      annotationName -
      Returns:
      a new build item
    • targetWithAnnotation

      @CheckReturnValue public static UnremovableBeanBuildItem targetWithAnnotation(org.jboss.jandex.DotName annotationName)
      Match beans whose target (class, method or field) is annotated with the specified annotation.
      Parameters:
      annotationName -
      Returns:
      a new build item