Skip to content

Support for dependency injection and initialization of test instances using classpath scanning [SPR-7937] #12592

Closed

Description

@spring-projects-issues

Magnus Heino opened SPR-7937 and commented

Maybe it's available already? I don't see anything about it though. This seems to work for me...

public class AnnotationConfigApplicationContextLoader implements ContextLoader {

    @Override
    public String[] processLocations(final Class<?> clazz, final String... locations) {
        return locations;
    }

    @Override
    public ApplicationContext loadContext(final String... locations) throws Exception {
        return new AnnotationConfigApplicationContext(locations);
    }

}

and then...

@ContextConfiguration(locations="se.lantmateriet.dominium", loader=AnnotationConfigApplicationContextLoader.class)
public class MyTests { ... }

Issue Links:

Activity

  1. spring-projects-issues commented on Sep 22, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Closing groups of outdated issues. Please reopen if still relevant.

  2. added
    status: declined
    in: test
    type: enhancement
    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

Labels

in: teststatus: declinedtype: enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions