I have a SpringBoot Application and I a config package with
@Configuration
@EnableJpaAuditing
public class PersistenceConfig {
}
You can try this:
annotate PersistenceConfig with @ComponentScan to enable component scanning in Spring.
@Configuration
@EnableJpaAuditing
@ComponentScan(basePackages = "com.yourbasepackage")
public class PersistenceConfig {
}
With no further configuration, @ComponentScan will default to scanning the same package as the PersistenceConfig class.
And add the @Context-Configuration annotation to tell it to load its configuration from the PersistenceConfig.class.
@RunWith( SpringRunner.class )
@DataJpaTest
@ContextConfiguration(classes=PersistenceConfig.class)
public class PersonRepositoryTest {
// Tests ...
}