Skip to content

Classpath scanning is not working with --patch-module #15476

Closed
@eiswind

Description

@eiswind

I try to run a simple WebMvcTest on the module path with maven.
My module is declared open, and requires all the spring modules on the compile path.
All the application stuff is on the module path, the test scope dependencies are on the classpath when maven surefire launches the test.
The maven approach to testing is adding the test classes to the module under test with --patch-module.

I see the following obstacles:
The test is not finding the @SpringBootConfiguration:
IllegalState Unable to find a @SpringBootConfig..

When I try to add an @ContextConfiguration manually, the ComponentScan does not find my RestController, so ComponentScan does not work either.

The application works otherwise fine on the module path, but testing is a must have to me.
From my observations so far I can only guess, that the resources are only searched on the folder that the test class is in. I put tracelevel on org.springframework.context.annotation and I did not see an attempt to scan the parent package of the test (where the SpringBootApplication lives).

So far I did not find any working example of a running spring test on the module-path, so I would really appreciate if someone could look into this. Please let me know if I can be of any assistance.

Activity

wilkinsona

wilkinsona commented on Dec 16, 2018

@wilkinsona
Member

Duplicates #13581 which led to SPR-16977.

added
status: invalidAn issue that we don't feel is valid
for: external-projectFor an external project and not something we can fix
and removed on Dec 16, 2018
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

    for: external-projectFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wilkinsona@eiswind@spring-projects-issues

        Issue actions

          Classpath scanning is not working with --patch-module · Issue #15476 · spring-projects/spring-boot