Hey, I’m new to Spring. In order to get a `DataJpa...
# spring
r
Hey, I’m new to Spring. In order to get a
DataJpaTest
working I had to add the annotation
@ComponentScan("com.my.package")
to the class. Is this normal? If so, is it documented?
Copy code
@DataJpaTest
@ComponentScan("com.my.package")
class UserTest @Autowired constructor(
    private val userService: UserService
): AnnotationSpec() {

    @Test fun `Test that findByEmail handles capitalization inconsistencies`() {
        val user = User(email = "mYeMail@gmail.COm", password = "password")
        val persistedUser = userService.createUser(user)
        val email = "MyEmaIL@GMAil.Com"
        val found = userService.find(UserEmailIdentity(email))
        found.email shouldBe persistedUser.email
    }
}
j
Did you read DataJpaTest documentation? It says "@Component beans are not loaded into the ApplicationContext."
r
Got it, thanks for pointing that out!