Class DIRegistry

java.lang.Object
java.util.AbstractMap<String,Map<Class<?>,Object>>
java.util.HashMap<String,Map<Class<?>,Object>>
java.util.LinkedHashMap<String,Map<Class<?>,Object>>
org.apache.camel.support.SimpleRegistry
org.apache.camel.support.SupplierRegistry
org.apache.camel.tooling.maven.support.DIRegistry
All Implemented Interfaces:
Closeable, Serializable, AutoCloseable, Cloneable, Map<String,Map<Class<?>,Object>>, org.apache.camel.spi.BeanRepository, org.apache.camel.spi.Registry

public class DIRegistry extends org.apache.camel.support.SupplierRegistry

SupplierRegistry extension that allows registration of bean recipes based on jakarta.inject annotations.

Such requirement was found when trying to configure maven-resolver without using the deprecated service locator helpers (see MRESOLVER-157).

See Also:
  • Constructor Details

    • DIRegistry

      public DIRegistry()
  • Method Details

    • bind

      public void bind(Class<?> type)
      Registration of a bean with the same lookup and target class.
      Parameters:
      type -
    • bind

      public void bind(Class<?> key, Class<?> type)
      Main "registration" method, where beanClass is expected to be a pojo class with non-default constructor annotated with Inject. The class may be annotated with Named. (Maybe supporting Singleton soon).
      Parameters:
      key - the lookup type
      type - the actual type (to use when instantiating a bean)
    • alias

      public void alias(Class<?> alias, Class<?> key)
      Make an alias point to the same target bean as existing key.
      Parameters:
      alias -
      key -
    • bind

      public void bind(String id, Class<?> type, Object bean)
      Specified by:
      bind in interface org.apache.camel.spi.Registry
      Overrides:
      bind in class org.apache.camel.support.SimpleRegistry
    • bind

      public void bind(String id, Class<?> type, Supplier<Object> bean)
      Specified by:
      bind in interface org.apache.camel.spi.Registry
      Overrides:
      bind in class org.apache.camel.support.SupplierRegistry
    • bindAsPrototype

      public void bindAsPrototype(String id, Class<?> type, Supplier<Object> bean)
      Specified by:
      bindAsPrototype in interface org.apache.camel.spi.Registry
      Overrides:
      bindAsPrototype in class org.apache.camel.support.SimpleRegistry
    • lookupByClass

      public <T> T lookupByClass(Class<T> cls)