Skip to content

SpringJUnit4ClassRunner is not compatible with java context configuration [SPR-7769] #12425

Closed

Description

@spring-projects-issues

Stepan Koltsov opened SPR-7769 and commented

have test:

@RunWith(SpringJUnit4ClassRunner.class)
@Import(SomeTestContext.class)
public class SomeTest {
 ....
}

get exception:

Caused by: java.lang.IllegalArgumentException: Can not load an ApplicationContext with a NULL 'contextLoader'. Consider annotating your test class with @ContextConfiguration.
	at org.springframework.util.Assert.notNull(Assert.java:112)
	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:276)
	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
	... 24 more

Affects: 3.0.2

Issue Links:

Activity

  1. spring-projects-issues commented on Mar 10, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Duplicates #10852. Using @Import here (per example) is an interesting idea, however.

  2. added
    type: bug
    in: data
    status: duplicate
    and removed
    type: bug
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: datastatus: duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions