I'm testing Spring Boot capabilities as a newbie in this area. I have a simple app with basic dependencies.
- sping-boot-starter-parent 1.5.7
- sping-boot-starter
- sping-boot-starter-data-jpa
- sping-boot-starter-test
Then there is simple Application class with @SpringBootApplication
annotation.
Then I have a simple DummyService with @Service
annotation.
Then I have created a simple test DummyServiceTest with one @Test
method and @RunWith(SpringRunner.class)
and @SpringBootTest
annotations.
@SpringBootTest
is the key problem. With spring-boot-starter-data-jpa dependency and this annotation test requires even @DataJpaTest
annotation. Without it the framework doesn't solve HibernateJpaAutoConfiguration
or DataSource
or other injection dependencies even if the test doesn't require using data.
Can I suppress it somehow? I'm not any kind of Spring guru so my guess is that there is some simple configuration to handle this problem.
P.S. Ok, back on trees. Even with @DataJpaTest
that test doesn't solve data dependencies. I tried add @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
and it doesn't work either. I tried add @Transactional
with the same result. It's a little bit beyond ridiculous.