Код: Выделить всё
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'XYZ' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
The bean XYZ is available in the GUICE context.
Код: Выделить всё
@SpringBootApplication
class Main {
// it is a spring boot application with guice injections
}
Код: Выделить всё
@RunWith(SpringRunner::class)
@SpringBootTest(classes = [Main::class])
@TestPropertySource(properties = arrayOf("spring.config.location = classpath:application-integration-test.yml"))
class MainIT {
@Autowired
private val controller: ApplicationContext? = null
@Test
fun verifyCreateForm() {
Assertions.assertEquals("", controller?.id)
}
}
Решение, позволяющее провести тест взаимодействия с приложением, в которое внедрены как Spring, так и Guice
Подробнее здесь: https://stackoverflow.com/questions/784 ... y-on-guice