Created
December 4, 2012 09:27
-
-
Save virasak/4202159 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testme; | |
import com.google.inject.ImplementedBy; | |
@ImplementedBy(AuthenFacadeImpl.class) | |
public interface AuthenFacade { | |
boolean login(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testme; | |
public class AuthenFacadeImpl implements AuthenFacade { | |
@Override | |
public boolean login() { | |
return false; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testme; | |
import com.google.inject.Binder; | |
import com.google.inject.Guice; | |
import com.google.inject.Injector; | |
import com.google.inject.Module; | |
import com.google.inject.Inject; | |
public class Main { | |
@Inject | |
private transient AuthenFacade af; | |
public static void main(String[] args) { | |
Injector injector = Guice.createInjector(new Module() { | |
@Override | |
public void configure(Binder binder) { | |
} | |
}); | |
Main mainMe = injector.getInstance(Main.class); | |
System.out.println(mainMe.af.login()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment