Example library with Liberator
Here's example for usage:
- Create an interface:
public interface SomeMagic {
void send(String msg);
}
- 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);
}
}
- 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;