title: Get field values in Runtime
body: <p>How to get value of the field in Runtime for Java?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>using this construction:</p>
  
  <pre><code>    ClassPathScanningCandidateComponentProvider scanner =
   new ClassPathScanningCandidateComponentProvider(
                      false);
          for (BeanDefinition bd : scanner
          .findCandidateComponents("aspectlogging"))
                          {
              Class myTarget = null;
                  try {
                          myTarget = Class.forName(bd.getBeanClassName());
                       }
                         catch (ClassNotFoundException e) {...}
                  for (Field f:myTarget.getDeclaredFields()){
                          try {
                              System.out.println("FIELD: " + f.get(myTarget));
                              } catch (IllegalArgumentException e) {...} 
                                catch (IllegalAccessException e) {...}
                      } }
  </code></pre>
  
  <p>I've got <code>java.lang.IllegalAccessException</code>,<br> when call <code>f.get(myTarget)</code>,<br> where  <code>myTarget</code> is the instance of bean got in Runtime and <code>f</code> is its field.</p>
  
  <p>when run in loop following:</p>
  
  <pre><code>System.out.println("FIELD: " + f);
  </code></pre>
  
  <p>got field names OK:</p>
  
  <pre><code>FIELD: private java.lang.String aspectlogging.TestableBean.name
  FIELD: private java.lang.String aspectlogging.TestableBean.name
  </code></pre>
  
  <p>It's quite strange,that value can't be got.</p>