質問: spring を扱っている人たちの間で、Checked Exception を取り扱うよりは、 Unchecked Exception を取り扱うほうが、 Spring Philosophy に合致している、という話を耳にします。 たとえば、次の本家SO の答えの最初の行です。 具体的に、これ(Unchecked Exception を使うこと)がどうして、 Spring philosophy に合致しているのかについての、 説明ないし、ソースを見つけられずにいるのですが、 ご存知の方はいらっしゃいますでしょうか。
回答: Checked/Unchecked Exceptionと"Spring philosophy"との関係への言及は、Spring Framework Reference Documentationで見つけられます。 > > 12.3 Understanding the Spring Framework transaction abstraction > > [...] > > Again in keeping with Spring's philosophy, the `TransactionException` that can be thrown by any of the `PlatformTransactionManager` interface's methods is *unchecked* (that is, it extends the `java.lang.RuntimeException` class). Transaction infrastructure failures are almost invariably fatal. In rare cases where application code can actually recover from a transaction failure, the application developer can still choose to catch and handle `TransactionException`. The salient point is that developers are not *forced* to do so. > > > 直接的に"Spring philosophy"を定義する文書は見つけられなかったのですが、Announcing Spring Framework 4.0 GA Releaseにphilosophyとprinciplesについての言及がありました。 > > The Spring Framework project page is always a great start. But we've worked hard on new guides to accompany the launch of the Framework. In keeping with our philosophy of "let's build a better enterprise" we've developed these getting started guides with a few principles: > > > * Be the simplest possible example, not the "best", as that is subjective > * Use the most up-to-date Spring best practices > * Do not give in to the temptation to become a full-blown tutorial, keep those separate > * Make assumptions. Separate underlying concepts into linked, distinct documents > * Stay task oriented, use case-oriented, explain things beyond Spring when relevant > * Above all, be a resource that experts and beginners alike can appreciate > > >