Closed
Description
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