Annotation Interface Managed


@Documented @Retention(RUNTIME) @Target(TYPE) public @interface Managed
A managed instance, of which life cycle is under the control of the IoC microkernel. Other managed instances which declare managed entities as a dependency by using Wire on their class fields, may directly use such without explicitly instantiating them:
   @Managed
   public class ManagedInstance {

       @Wire
       private AnotherManagedInstance another;

       public void foo() {
            another.bar();
       }
   }
 
The manage instances can be explicitly named. If so, they are called as named managed instances. In this case, optional name parameter is used in Managed and Wire annotations to linked dependent objects together:
   @Managed(managedInstanceName="This")
   public class ManagedInstance {

       @Wire(managedInstanceName="That")
       private AnotherManagedInstance another;

       public void foo() {
            another.bar();
       }
   }
 
Managed instances may have configurations which can be injected to the injection points. To define configuration injection points, Configurable annotation is used:
   package com.foo;

   @Managed(managedInstanceName="Bar")
   public class ManagedInstance {

       @Configurable(name="temp")
       private Integer temp;

   }
 

The name of the configuration source is the name of the managed instance, if the managed instance is a named one, e.g., Foo.properties in the above example, otherwise the package name plus the class name, e.g, com.foo.ManagedInstance.properties.

A managed instance must be a concrete type. The interfaces and abstract classes may not be managed instance.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional name of the managed instance that can be used in Wire annotation.
  • Element Details

    • name

      String name
      Optional name of the managed instance that can be used in Wire annotation.
      Returns:
      The name of the managed instance.
      Default:
      ""