title: AppConfig encounter NullPointerException Error
body: <p>Update: I downloaded authors source code, same issue happeded.....
  pom.xml file&gt; <a href="https://gist.github.com/jianheMark/09c8e250f43d436ba51d27971c4ea5a2" rel="nofollow noreferrer">https://gist.github.com/jianheMark/09c8e250f43d436ba51d27971c4ea5a2</a>
  Follow tutorial. But when I run it, then there is NullPointerException Error. I using Intellj.</p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.NullPointerException: Cannot invoke &quot;Object.getClass()&quot; because &quot;cause&quot; is null
  </code></pre>
  <p>All three classes in same package. I already checked on internet. I even comment out other xml files.</p>
  <pre><code>package javaconfig;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  @Configuration
  public class AppConfig{
  
      @Bean(initMethod = &quot;customInit&quot;)
      public Customer customer(){
          return new Customer();
      }
  }
  
  
  public class Customer {
      public Customer() {
          System.out.println(&quot;Default Constructor.......&quot;);
      }
      public void customInit() {
          System.out.println(&quot;Customer Init......&quot;);
      }
  }
  
  
  
  package javaconfig;
  import org.springframework.context.annotation.AnnotationConfigApplicationContext;
  public class JavaConfigMain {
      public  static void main(String[] args){
         
          new AnnotationConfigApplicationContext(AppConfig.class);
      }
  }
  </code></pre>
  <p>I follow this tutorial: <a href="https://www.youtube.com/watch?v=0awHx-346Is&amp;list=PLGTrAf5-F1YIUo_AWConTTY_VWGJnveT8&amp;index=15" rel="nofollow noreferrer">https://www.youtube.com/watch?v=0awHx-346Is&amp;list=PLGTrAf5-F1YIUo_AWConTTY_VWGJnveT8&amp;index=15</a></p>
  <p>Full Error Code:</p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.NullPointerException: Cannot invoke &quot;Object.getClass()&quot; because &quot;cause&quot; is null
      at org.springframework.cglib.core.CodeGenerationException.&lt;init&gt;(CodeGenerationException.java:25)
      at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:587)
      at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363)
      at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585)
      at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110)
      at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108)
      at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
      at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
      at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134)
      at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319)
      at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:572)
      at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:419)
      at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:137)
      at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109)
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:447)
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:268)
      at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:325)
      at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:147)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
      at org.springframework.context.annotation.AnnotationConfigApplicationContext.&lt;init&gt;(AnnotationConfigApplicationContext.java:93)
      at javaconfig.JavaConfigMain.main(JavaConfigMain.java:12)
  </code></pre>