Pihentagy
10/01/2024, 1:25 PM@Autowired val
parameters?
So one can write this
class MyRepositoryTests(@Autowired val entityManager: TestEntityManager, @Autowired val repository: UserRepository)
while in java you should have an Autowired field (seen at https://docs.spring.io/spring-boot/reference/testing/spring-boot-applications.html#testing.spring-boot-applications.autoconfigured-spring-data-jpa)Daniel Pitts
10/01/2024, 2:13 PMSzymon Jeziorski
10/02/2024, 6:26 AM@Autowired
, the same way as you can in the main source sets:
furthermore, you can set that globally for your tests by setting junit config parameter:
https://docs.spring.io/spring-framework/reference/languages/kotlin/spring-projects-in.html#constructor-injection