I am working on refactoring a Spring Boot application from Java to Kotlin. I have made the necessary updates to the build.gradle file.
Firstly, I refactored the Application class from Java to Kotlin. The application is running fine; however, when building the application, I encounter the following error for every unit test class:
ProjectServiceTest > initializationError FAILED
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:76)
at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.findConfigurationClass(SpringBootTestContextBootstrapper.java:246)
at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.getOrFindConfigurationClasses(SpringBootTestContextBootstrapper.java:233)
at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.processMergedContextConfiguration(SpringBootTestContextBootstrapper.java:150)
at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:351)
at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:267)
at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:215)
at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:108)
at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:111)
Below is the ApplicationTest class:
@SpringBootTest
public class AppserverApplicationTests {
@Test
public void contextLoads() {
// do nothing
}
}