Skip to content

WebGraphQlTester bean missing with SpringBootTest #29250

@Thinkenterprise

Description

@Thinkenterprise

Section 9.12.3 of the documentation describes that a test can be started with Live Server.

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MockMvcGraphQlTests {

    @Autowired
    private WebGraphQlTester graphQlTester;

}

But the autoconfiguration of WebGraphQlTesterAutoConfiguration is then not active and no WebGraphQlTester is created. I get the error message that the WebGraphQlTester bean cannot be found. That only works if the annotation @AutoConfigureWebGraphQlTester is set.

It would be nice if this worked like it did with REST.

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MockMvcRestTests {

    @Autowired
    private TestRestTemplate testRestTemplate;

}

I don't understand why the @Autoconfiguration .. has to be added there.

However, the documentation may not be correct like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions