title: java.lang.reflect.InvocationTargetException in PostConstruct method
body: <p>I am trying to validate the values returned by a list of methods using java reflection and <code>@PostConstruct</code> spring annotation as it is depicted in the following code snippet :</p>
  
  <pre><code>@Service("appConfigService")
  public class AppConfigServiceImpl implements AppConfigService{       
  
      //rest of source code including constructor and other methods is omitted 
  
      @Override
      public String getServerURL(){//example of a method I am invoking in the postConstruct phase
         //method body omitted
      }
  
      @PostConstruct
      public void postConstruct() {
          try {
              Class&lt;AppConfigServiceImpl&gt; classObject = AppConfigServiceImpl.class;
              AppConfigServiceImpl appConfigServiceImpl = classObject.newInstance();
              Method[] methods = classObject.getMethods();
              for(Method method: methods)     
                  method.invoke(appConfigServiceImpl);            
          } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>However when spring executes the <code>postConstruct()</code> method a <code>java.lang.reflect.InvocationTargetException</code> is thrown. I could not figure out the source of the exception. Any help will be more than welcome.</p>