Comment by vbezhenar
3 days ago
Yeah, it works until it isn't. And they good luck debugging it. I'd prefer simple obvious linear code calling some functions over this declarative magic any day.
cronService.schedule("xxx", this::refresh);
This isn't any harder than annotation. But you can ctrl+click on schedule implementation and below easily. You can put breakpoint and whatnot.
never had any issues debugging as I am never debugging the scheduler (that works :) ) but my own code.
and what exactly is “cronService”? you write in each service or copy/paste each time you need it?
`cronService` is an injected instance of some class, probably provided by framework. My point is to demonstrate alternative, imperative way of defining cron tasks, as compared to declarative one.
A better name would probably be CronScheduler or something else. “Service” is always overused and doesn’t actually describe or mean anything.
You can write your own libraries?
My goodness. What a question!
Whole point of spring is so you don't have to write your own libraries. Batteries included and all.
6 replies →
you write your own database driver? encryption?
8 replies →