title: How to initialize Spring application context file in Selenium TestNG environment
body: <p>How to initialize a Spring application context File in Selenium TestNG environment in Spring 5?</p>
  <p>I tried the following code, but it's using classpathapplicationcontext, so every build will delete the application context file.</p>
  <pre><code> public class SpringInitManager {
          private ClassPathXmlApplicationContext ctx;
  
      public void init() {// &quot;classpath:applicationContext.xml&quot;
          setCtx(new ClassPathXmlApplicationContext(&quot;classpath:applicationContext.xml&quot;));
      }
      // 
      public ClassPathXmlApplicationContext getCtx() {
          return ctx;
      }
      // 
      public void setCtx(ClassPathXmlApplicationContext ctx) {
          this.ctx = ctx;
      }
  }
  </code></pre>
  <p>It works in Eclipse, but not in IntelliJ.</p>