Brilliant article.<p>I dislike annotation-driven code, as well as opinionated frameworks like Spring.<p>Throwing out Spring (or similar) is probably not going to happen if your team uses it.<p>I have found that you can greatly reduce your coupling to Spring (and other annotations) while still letting it work for you.<p>To do so, you use inheritance (which in general I dislike, but in this case - two wrongs make a right?)<p>Split your FooService into two: {SpringFooService and FooService}, where SFS inherits from FS.<p>* SFS may contain annotations, but FS must not.
* FS must contain all your business logic. SFS must be a thin 1:1 wrapper over FS.<p>This means that:
* SFS can be autowired, and managed by Spring.
* Your business logic remains "simply-instantiable" with _new_ for the purposes of unit testing.