Spring @ContextConfiguration annotation, TestNG and IDEA

Go To StackoverFlow.com

2

I am running into a problem with IDEA and I would appreciate any help in resolving this. I have a test class(TestNG) that references a Spring (3.1) configuration file for DI. This works fine when running the test through mvn. It also works fine when running it in Eclipse. However when I try to run it through IDEA it seems that DI doesn't take place and my test fails. Interestingly enough the IDE seems to properly resolve the beans in my test class. Here is how the code looks:

@ContextConfiguration("classpath:my-config.xml")
public BaseTest
{
   @Autowired
   private SomeType myVar;       


}

public Test1 extends BaseTest
{
    public void someTest()
    {
        // uses myVar but fails because it's null

    }
}
2012-04-04 22:16
by Quantum_Entanglement
have you solved it - And 2012-12-03 06:23


1

The xml files are not probably copied to your classpath. This may help.

2012-04-05 04:05
by Adi
That's not it. The xml files get copied properly. However I forgot to mention that the config.xml is actually coming from another module. That module is listed as a dependency - Quantum_Entanglement 2012-04-05 20:09
Ads