Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 783 Bytes

README.md

File metadata and controls

44 lines (31 loc) · 783 Bytes

AutoInjector

Example library with Liberator

Overview

Here's example for usage:

  1. Create an interface:
public interface SomeMagic {
    void send(String msg);
}
  1. Implement the interface and here should be used the @Service annotation:
@Service
public class SomeMagicImpl implements SomeMagic {

    @Override
    public void send(String msg) {
        System.out.println(msg);
    }
    
}
  1. Inject with @AutoInject annotation:
    //case 1: just one class implements interface
    @AutoInject
    private SomeMagic magic;
    
    //case 2: more than one 
    @AutoInject(SomeMagicImpl.class)
    private SomeMagic pureMagic;
    

Example project:

AutoInjectorExample