I am developing a Spring application, and was wondering if there a part of the framework that let's me do something like this in a more elegant way, such as configuring something in XML?
If the purpose of your question is to set a custom UncaughtExceptionHandler through your application context, you can use:
<bean id="myhandler" class="java.lang.ThreadGroup">
    <constructor-arg value="Test"/>
</bean>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
   <property name="targetClass" value="java.lang.Thread"/>
   <property name="targetMethod" value="setDefaultUncaughtExceptionHandler"/>
   <property name="arguments">
     <list>
         <ref bean="myhandler" />
     </list>
   </property>
</bean>
(N.B. replace myhandler with an Thread.UncaughtExceptionHandler of choice...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With