Spring Boot Active Profile: How to configure datasource properties for your test classes

preview_player
Показать описание
In this tutorial, you are going to learn how to set the active profile in your Spring Boot tests. This will allow you to use a different configuration for your test classes. This is great for a scenario like the one we cover here where the properties of a test database and development database will be different. Here we know that when we run tests against our database we will always have a fixed data set which makes our tests repeatable.

🔗Resources & Links mentioned in this video:

👋🏻Connect with me:

Рекомендации по теме
Комментарии
Автор

wow! The fast forward sound was very unexpected and frightening :)

artemgoncharenko
Автор

Just what I need !! Thank you very helpful! :-)

StefhaniLGomez
Автор

Is there a way to isolate a single method? In my case, i want to set a specific method to use another sql file.

tiannel
Автор

Hi! And what about the case when we deploy our app in Docker in 2 different containers: i.e. App and Postgres. Then we need to assign SQL script not to App profile but to Postgres container. So is there any way to parameterize my containers and to set up profiles for them like we did it inside just only spring app?

MrRomanvideo
Автор

Nice work but as for me the better idea is to create application.properties file inside of the test package setting active profile there.

yuriihizun