Я пишу тест Junit для службы весенней загрузки, для тестирования вызова API, но не удалось запустить выбрасывание следующего исключения
Caused by:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'resourceServerConfig': Unsatisfied dependency expressed through field 'entryPoint'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'jwtAuthenticationEntryPoint': Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)
Тест Junit:
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = Application.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class ServiceTest {
@Autowired
protected WebApplicationContext wac;
protected MockMvc mockMvc;
@Before
public void setup() {
this.mockMvc = webAppContextSetup(this.wac).build();
}
@Test
public void validateApiCall() throws Exception {
String token = "Bearer xxxxxxxx";
mockMvc.perform(MockMvcRequestBuilders.get("http://localhost::8060/api").header("Authorization", token)).andExpect(status().isOk());
}
}