problem with running Spring JUnit test case under Intellij

I am having problem to run Spring JUnit test case under Intellij. with error

Configuration problem: Duplicate <http> element detected


The error happens when I load all the Spring's application context which include Spring Security configuration. E.g.

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:**/*Context.xml"})
@Transactional
public class MyTestCaseWithAllContexts {
     ...
}


but if I only load specific context only it works. E.g.

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:coreContext.xml","classpath*:myOtherContext.xml"})
@Transactional
public class MyTestCaseWithSomeContexts {
     ...
}


I am not sure whether it is problem with Intellij or maybe my project setup. My project is set up to use

project
  |- core-module
  |         |- src
  |             |- main
  |                  |- java
  |                       |- MyTestCaseWithAllContexts
  |                       |- MyTestCaseWithSomeContexts
  |                       |- ...
  |- web-module
            |- src
                |- main
                     |- resources
                            |- coreContext.xml
                            |- myOtherContext.xml
                            |- securityContext.xml (location of Spring Security etc)
                            |- ...


I use

  • Spring 3
  • Maven 2.2.1


Any insight or help is appreciated. Thanks

1 comment

Just tried to reproduce your use-case with the following actions:

  • created two IDEA Spring-aware modules;
  • put two Spring config files and Spring Security file to source root of one module;
  • created spring test class at another module and made that module depend from the one with config files;


Result: the test is successfully executed.

We need to be able to reproduce the problem at local environment, hence, it would be nice if you create minimal but complete standalone example (archive that contains standalone preconfigured IDEA project with target classes and config files) and provide it to us.

Regards, Denis

0

Please sign in to leave a comment.