This is the right way to build it. Sadly it's not easy maintaining it this way, and the order in which you do this can matter profoundly.
Which is not to discourage the practice, but merely to point out there are no silver bullets and being able to read Java stack traces and reason a bit...