Skip to content

Instantly share code, notes, and snippets.

@amitayh
Created December 1, 2014 19:36
Show Gist options
  • Save amitayh/dd5b4c45b47e37260e64 to your computer and use it in GitHub Desktop.
Save amitayh/dd5b4c45b47e37260e64 to your computer and use it in GitHub Desktop.
logging
public class AuthService implements AuthServiceInterface {
private Logger logger;
// ...
public void setLogger(Logger logger) {
this.logger = logger;
}
}
public class AuthServiceProvider implements ServiceProvider {
@Override
public Object create(Container container) throws Exception {
Connection mysql = (Connection) container.get("mysql");
Logger logger = (Logger) container.get("logger");
AuthService auth = new AuthService(mysql);
auth.setLogger(logger);
return auth;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment