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
| ✅ Inject it and use it: | |
| ... | |
| @Autowired | |
| TaskScheduler scheduler; | |
| scheduler.schedule( | |
| () -> System.out.println("Hello!"), | |
| new CronTrigger("0 */5 * * * *") // every 5 min | |
| ); |
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
| Given a class: | |
| class Report { | |
| void print() { | |
| ... | |
| } | |
| } | |
| ❌ If we extend the class without @Override: |
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
| ✅ Suppose you have a Shape interface: | |
| interface Shape { | |
| double area(); | |
| } | |
| ✅ A typical implementation would be: | |
| class Circle implements Shape { | |
| private double radius; |