Skip to content

Upgrading from 2.8.0 to 2.9.0 causes SpringBootTest to stop working #2441

@maraswrona

Description

@maraswrona

Springfox: upgrade 2.8.0 -> 2.9.0
SpringBoot: 1.5.12
Spock: 1.1-groovy-2.4-rc-4

Issue: when trying to run @SpringBootTest it fails with a message

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

I have my Application class annotated with @SpringBootApplication and placed in root package hierarchy, so it's not the cause.
Also, of course, it worked before just fine - reverting back to 2.8.0 fixes the problem.
Also, adding classes = Application.class to @SpringBootTest also fixes the problem.

Seems like #2438 and #2388 may be related?

Any hints?

Full stacktrace:

2018-05-24 12:00:53.023 INFO --- [ main] .b.t.c.SpringBootTestContextBootstrapper : Neither @ContextConfiguration nor @ContextHierarchy found for test class [pl.airly.dao.InstallationCalibrationDaoTest], using SpringBootContextLoader 2018-05-24 12:00:53.241 INFO --- [ main] o.s.t.c.support.AbstractContextLoader : Could not detect default resource locations for test class [pl.airly.dao.InstallationCalibrationDaoTest]: no resource found for suffixes {-context.xml, Context.groovy}. 2018-05-24 12:00:53.252 INFO --- [ main] t.c.s.AnnotationConfigContextLoaderUtils : Could not detect default configuration classes for test class [pl.airly.dao.InstallationCalibrationDaoTest]: InstallationCalibrationDaoTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration. java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test	at org.springframework.util.Assert.state(Assert.java:70)	at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.getOrFindConfigurationClasses(SpringBootTestContextBootstrapper.java:202)	at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.processMergedContextConfiguration(SpringBootTestContextBootstrapper.java:137)	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:397)	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:311)	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:265)	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:105)	at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:82)	at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:120)	at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:105)	at org.spockframework.spring.SpringTestContextManager.<init>(SpringTestContextManager.java:35)	at org.spockframework.spring.SpringExtension.visitSpec(SpringExtension.java:65)	at org.spockframework.runtime.ExtensionRunner.runGlobalExtensions(ExtensionRunner.java:46)	at org.spockframework.runtime.ExtensionRunner.run(ExtensionRunner.java:40)	at org.spockframework.runtime.Sputnik.runExtensionsIfNecessary(Sputnik.java:88)	at org.spockframework.runtime.Sputnik.getDescription(Sputnik.java:55)	at com.intellij.junit4.JUnit4IdeaTestRunner.getDescription(JUnit4IdeaTestRunner.java:78)	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Process finished with exit code -2 Empty test suite. 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions