-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Closed as not planned
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
The following test case works well on spring boot 3.5:
package br.gov.ce.seplag.adbens.controllers;
import br.gov.ce.seplag.adbens.models.organizacao.Orgao;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.test.client.TestRestTemplate;
import org.springframework.test.context.ActiveProfiles;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue;
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class OrgaosControllerTest {
@Autowired
private TestRestTemplate restTemplate;
@Test
void deveriaListarOrgaos() {
var result = restTemplate.getForObject("/orgaos", Orgao[].class);
assertThat(result, notNullValue());
}
}
In spring boot 4 it fails on autowiring the TestRestTemplate
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.web.server.test.client.TestRestTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Metadata
Metadata
Assignees
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid