class MainService {

    public void doSomething() {
        if (restService == null) {
           System.out.println("restService not allowed to be null");
        }
        String s = restService.getSomething();
        System.out.println(s);
        if (printer == null) {
            System.out.println("printer not allowed to be null");
        }

        printer.print(s.toUpperCase());
    }

    @Inject public  MainService(RestService restService,  MyPrinter printer);

}