Annotation Type DefaultImplementation


  • @Documented
    @Retention(RUNTIME)
    @Target(TYPE)
    @Inherited
    public @interface DefaultImplementation

    An annotation to apply to an interface to indicate which implementation is the default implementation. The initial use case is to redirect Replaces to another class to allow the replacement of an implementation that isn't accessible due to visibility restrictions.

    For example:

     @DefaultImplementation(MyImpl.class)
     public interface SomeInterface {
    
     }
    
     class MyImpl implements SomeInterface {
    
     }
    
     @Replaces(SomeInterface.class)
     class OtherImpl implements SomeInterface {
    
     }
     

    In the above example the OtherImpl bean will replace the MyImpl bean because the class in the Replaces annotation has a default implementation.

    Since:
    1.2.0
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String name  
      java.lang.Class value  
    • Element Detail

      • value

        java.lang.Class value
        Returns:
        The bean type that is the default implementation
        Default:
        void.class
      • name

        java.lang.String name
        Returns:
        The fully qualified bean type name that is the default implementation
        Default:
        ""