AnsweredAssumed Answered

activiti spring test

Question asked by parul_vipparthi on Dec 4, 2010
Latest reply on Dec 4, 2010 by frederikheremans1
Hello

I am new to Spring. This code gives nullpointerexception.


@ContextConfiguration("classpath:org/activiti/spring/test/gal_example/springTest-context.xml")
public class SpringTest{

   ProcessEngine processEngine;
   @Autowired
   ApplicationContext applicationContext;
        void initializeProcessEngine() {
        System.out.println("  " + applicationContext);
         processEngine = applicationContext.getBean(ProcessEngine.class);
        System.out.println("  " + processEngine);
     }

     public static void main(String[] args) {
      new SpringTest().initializeProcessEngine();
   }
}

but this code works fine

public class SpringTest{

   ProcessEngine processEngine;
     void initializeProcessEngine() {
        ClassPathXmlApplicationContext applicationContext =
             new ClassPathXmlApplicationContext("org/activiti/spring/test/gal_example/springTest-context.xml");
        System.out.println("  " + applicationContext);
         processEngine = applicationContext.getBean(ProcessEngine.class);
        System.out.println("  " + processEngine);
     }

     public static void main(String[] args) {
      new SpringTest().initializeProcessEngine();
   }
}

what went wrong?

Thank you

Outcomes