Posts

Showing posts from January, 2016

Spring Framework and Code Obscurity

I just realized why what I don't like about Spring Framework. Don't get me wrong. I love Spring Framework. I use it daily. In fact, I am a huge fan of it. But there is a constant "something is wrong" buzz in the corner of my mind. And I finally caught it. The name is Obscurity Yes, all the Spring annotation fairy dust magic just works. It is great. It removes boilerplate code. It is supposed to make your code easier to read and maintain. And it does - to a point when it doesn't. A simple example: @Scheduled(fixedDelayString="${execution.delay_ms}") public void scheduledJob(){ // your code goes here } Easy, right? A few lines of code, a configurable property to define a delay between runs, what can be more simple? A few questions: How do you know what threadpool this scheduled job used? How do you to configure the threadpool? How do you test the scheduling part of your code? Ouch, painful!