Skip to content

Instantly share code, notes, and snippets.

@CristianoPassos
Last active June 17, 2019 14:14
Show Gist options
  • Save CristianoPassos/980c0cb3ccd162dd71d5bafb459bd64b to your computer and use it in GitHub Desktop.
Save CristianoPassos/980c0cb3ccd162dd71d5bafb459bd64b to your computer and use it in GitHub Desktop.
public interface MyServiceInterface {
void myMethod();
}
@Service
public class MyServiceA implements MyServiceInterface {
@Override
public void myMethod() {
System.out.print("Do A");
}
}
@Service
public class MyServiceB implements MyServiceInterface {
@Override
public void myMethod() {
System.out.print("Do B");
}
}
@Service
public class MyBusinessLogic {
@Autowired
private MyServiceInterface myServiceInterface;
public void businessLogic() {
System.out.println("Do something");
myServiceInterface.myMethod();
System.out.println("Done");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment