Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native tests fail when using @SpringBootTest with RANDOM_PORT or DEFINED_PORT #32542

Closed
rajadilipkolli opened this issue Sep 29, 2022 · 2 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@rajadilipkolli
Copy link
Contributor

After upgrading the project to spring boot 3.0.0-M5 and running native tests it is failing with below error. Expectation that it should work without any configuration

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer$TestRestTemplateRegistrar': Runtime reflection is not supported for org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer$TestRestTemplateRegistrar()

For more info about error logs

Sample to reproduce the issue

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 29, 2022
@wilkinsona wilkinsona changed the title Spring Native Tests failing when @AutoConfigureMockMvc is present Native tests fail when @AutoConfigureMockMvc is present Sep 29, 2022
@wilkinsona wilkinsona changed the title Native tests fail when @AutoConfigureMockMvc is present Native tests fail when using @SpringBootTest with RANDOM_PORT or DEFINED_PORT Sep 29, 2022
@wilkinsona
Copy link
Member

Thanks, @rajadilipkolli. The problem appears to be due to @SpringBootTest with a non-mock web environment. As you're using MockMvc anyway, you could avoid the problem for now by using @SpringBootTest rather than @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT).

@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 29, 2022
@wilkinsona wilkinsona added this to the 3.0.x milestone Sep 29, 2022
@wilkinsona wilkinsona self-assigned this Sep 30, 2022
@wilkinsona wilkinsona added the for: team-meeting An issue we'd like to discuss as a team to make progress label Oct 5, 2022
@philwebb philwebb removed the for: team-meeting An issue we'd like to discuss as a team to make progress label Oct 5, 2022
@philwebb
Copy link
Member

philwebb commented Oct 5, 2022

We'll use the simple if fix for now and raise a Framework issue to see if we can improve the situation later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants