6

I have a SpringBoot application with hibernate. In my tests I would like to disable any sort of db connection and configuration (tests don't have access to db). How should I do it ?

My test class is annotated with @SpringBootTest and has @Autowired properties. What's the proper annotation value to disable all db interactions ?

@SpringBootTest
class MyTest {

  @Autowired
  ....
}

HIT_girl
  • 785
  • 7
  • 23

1 Answers1

-1

You can use @TestPropertySource to override values in application.properties.

@TestPropertySource(locations="classpath:test.properties")

A Quick Guide to @TestPropertySource

dasunse
  • 2,839
  • 1
  • 14
  • 32