0

我的测试类看起来像:

@WebFluxTest(controllers = IndexContoller.class)
@Import(UserServiceImpl.class)
class IndexContollerTest {
    private static final String PATH = "/";
    private static final String ADD_USER = "/signup";
    @MockBean
    private UserRepo userRepo;
    @Autowired
    private WebTestClient webClient;
    @Autowired
    private ReactiveUserDetailsService userService;

    @Test
    void saveUser() throws Exception {
    Mockito.when(userRepo.save(any())).thenReturn(Mono.just(new User()));
    webClient.post()
            .uri(ADD_USER)
            .contentType(MediaType.APPLICATION_JSON)
            .body(BodyInserters.fromObject(new User()))
            .exchange()
            .expectStatus()
            .is2xxSuccessful();}
    }

在我运行它之后,它与

原因:org.springframework.beans.factory.BeanCreationException:创建名称为 'skillGroupRepository' 的 bean 在 RoadmapApplication 上声明的 @EnableR2dbcRepository 中定义的 com.gmail.qwertygoog.roadmap.repository.SkillGroupRepository 时出错:无法解析对 bean 'r2dbcEntityTemplate' 的引用同时设置bean属性'entityOperations';嵌套异常是 org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'r2dbcEntityTemplate' available

基本上它搜索不同的服务bean的依赖关系并在无法实例化它之后下降。我还尝试添加@SpringExtension,但输出没有任何差异。有什么建议么?

4

0 回答 0