intelligence_src_6dc544294b7f21f98a
- Source-provided label
- Publisher RSS metadata
- Evidence class
- mentioned in report
- Confidence
- Not reported
- Observed
- Nov 26, 2026 17:40 UTC
- Retrieved
- Nov 26, 2026 17:53 UTC
You bump the Spring Boot version to 4, run the build, and the main code compiles fine. Then the tests fail with a wall of errors like these: cannot find symbol symbol: class MockBean package org.springframework.boot.test.autoconfigure.web.servlet does not exist The test code itself is fine. Spring Boot 4 removed @MockBean and @SpyBean, split the test starter into one starter per technology, and moved the slice annotations like @WebMvcTest and @DataJpaTest to new packages. Once you know the new names, the fixes are mostly search and replace. Below is each one, shown on a small Books app with three tests that pass on Spring Boot 4.1.2. The app under test A Book entity, a repository, a service and a controller with one endpoint: `@RestController @RequestMapping("/books") public class BookController { private final BookService service; public BookController(BookService service) { this.service = service; } @GetMapping("/{id}") public Book get(@PathVariable long id) { return service.get(id); } @ExceptionHandler(BookNotFoundException.class) ProblemDetail notFound(BookNotFoundException e) { return ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, e.getMessage()); } } @Service public class BookService { private final BookRepository books; public BookService(BookRepository books) { this.books = books; } public Book get(long id) { return books.findById(id).orElseThrow(() -> new BookNotFoundException(id)); } } public interface BookRepository extends JpaRepository { List findByAuthor(String author); }` Book is a plain JPA entity with id, title and author, and the app uses an in-memory H2 database. Fix 1: Test dependencies In Boot 3, spring-boot-starter-test gave you everything. In Boot 4, each technology has its own test starter, and the slice annotations only exist if you add the matching one: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webmvc-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa-test</artifactId> <scope>test</scope> </dependency> Both include JUnit, AssertJ and Mockito, so you don't need spring-boot-starter-test next to them. There are matching ones for other modules too, for example spring-boot-starter-security-test and spring-boot-starter-data-redis-test. As a rule of thumb, if the app has spring-boot-starter-X, the tests probably need spring-boot-starter-X-test. Fix 2: @MockBean becomes @MockitoBean Here's a controller test on Boot 4: `import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.assertj.MockMvcTester; @WebMvcTest(BookController.class) class BookControllerTest { @Autowired MockMvcTester mvc; @MockitoBean BookService service; @Test void returnsBook() { when(service.get(1L)).thenReturn(new Book("Dune", "Frank Herbert")); assertThat(mvc.get().uri("/books/1")) .hasStatusOk() .bodyJson().extractingPath("$.title").isEqualTo("Dune"); } @Test void missingBookIs404() { when(service.get(99L)).thenThrow(new BookNotFoundException(99L)); assertThat(mvc.get().uri("/books/99")) .hasStatus(404) .bodyJson().extractingPath("$.detail").isEqualTo("Book 99 not found"); } }` Three changes from a Boot 3 test: @MockBean is now @MockitoBean. It comes from Spring Framework itself (org.springframework.test.context.bean.override.mockito), not from Boot. You use it the same way: put it on a field and stub it with when
655e9b273a20b98801ef7cc8e45e4bf224ad9cc2ecaee73db3aec0d1ba0aad25Network indicators are visibly defanged. This page does not make them clickable or send them to another service.
No validated file hashes or network indicators are stored for this record.
This record contains metadata and attribution only. It does not host, download, unpack, render, or execute malware samples.
Sources represented on this page. Publication and observation dates describe the content; successful batch dates describe local collection. A recent batch does not certify complete coverage or current provider availability.
1 sources: 0 stale, 0 needing attention, 0 paused, 0 unverified.
Stale means older than twice the recorded collection interval, with a minimum of one hour; without an interval, the threshold is 24 hours. Cached content remains available while a feed is stale, paused, or unverified.