Создание и поднятие контекста для тестирования приложения в Spring Framework можно осуществить с помощью класса org.springframework.test.context.junit.jupiter.SpringJUnitJupiterConfig и аннотации @ContextConfiguration. Вот пример: <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency> 2. Создайте Java-класс, который будет представлять ваш тест: import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {MyConfig.class})
public class MyTest {
@Autowired private MyService myService;
@Test public void testMyService() {
// Тестирование методов MyServ