Skip to content

SpringBootTest does not work with Java 10/modules [SPR-16976] #21514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jun 26, 2018 · 2 comments
Closed
Assignees
Labels
in: test Issues in the test module status: invalid An issue that we don't feel is valid

Comments

@spring-projects-issues
Copy link
Collaborator

Keir Lawson opened SPR-16976 and commented

I attempted to port the Spring web testing example at https://github.com/spring-guides/gs-testing-web to Java 10 and modules, however I find when running my tests via Maven that the @SpringBootTest annotation is no longer able to locate my application class despite the code working previously before modularisation.I receive the following error when running mvn test

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

Adding the application class explicitly as this message suggests then results in

java.lang.reflect.InaccessibleObjectException: Unable to make field private static java.lang.Object hello.Application$$EnhancerBySpringCGLIB$$d7dfca41.CGLIB$CALLBACK_FILTER accessible: module gs.testing.web does not "opens hello" to unnamed module @2fc6f97f

The changes I made to the initial repo can be viewed here: spring-guides/gs-testing-web@master...keirlawson:j10_modules


No further details from SPR-16976

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Please report this to the Spring Boot issue tracker on GitHub first: https://github.com/spring-projects/spring-boot/issues

There might be a core framework issue hiding here (which this JIRA instance is for) in which case I'm happy to reopen this JIRA ticket after the Boot team had a first pass.

@spring-projects-issues
Copy link
Collaborator Author

Keir Lawson commented

Have opened spring-projects/spring-boot#13581 as requested.

@spring-projects-issues spring-projects-issues added type: bug A general bug status: invalid An issue that we don't feel is valid in: test Issues in the test module labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug A general bug label Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

2 participants