title: Java - Pack all class methods in try{ }catch block
body: <p>Is there any way to pack all class methods in try{ }catch block without writing it in each method?</p>
  
  <p>in example I have that class:</p>
  
  <pre><code>class Sample{
    public void test(){
      try{
        ...
      }catch(){
        //doing rollback
      } 
    }
  
    public void test2(){
      try{
        ...
      }catch(){
        //doing rollback
      } 
    }
  }
  </code></pre>
  
  <p>I don't want to write that try catch block for each method. is there any way to extract try..catch block to some code and "inject" it in each method?</p>