{"id":"72cb0db4-a7dc-46f9-966a-7aaba53bc1ac","slug":"spring-boot-error-package-org-springframework-boot-test-4fdb","url":"https://api.modalhub.ai/r/spring-boot-error-package-org-springframework-boot-test-4fdb","urls":{"html":"https://api.modalhub.ai/r/spring-boot-error-package-org-springframework-boot-test-4fdb","md":"https://api.modalhub.ai/r/spring-boot-error-package-org-springframework-boot-test-4fdb.md","json":"https://api.modalhub.ai/r/spring-boot-error-package-org-springframework-boot-test-4fdb.json","history":"https://api.modalhub.ai/r/spring-boot-error-package-org-springframework-boot-test-4fdb/history","worked":"https://api.modalhub.ai/r/spring-boot-error-package-org-springframework-boot-test-4fdb/worked","didnt":"https://api.modalhub.ai/r/spring-boot-error-package-org-springframework-boot-test-4fdb/didnt"},"symptom":"error: package org.springframework.boot.test.autoconfigure.web.servlet does not exist","command":null,"exit_code":null,"tool":"spring-boot","version":"4.0.0","os":null,"date":"2026-11-05","cause":"Boot 4 split spring-boot-test-autoconfigure into per-technology modules; MockMvc and @WebMvcTest support moved to spring-boot-webmvc-test under a new package","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;\n+import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; // @WebMvcTest: same package\n// build.gradle (Maven: same artifactId, <scope>test</scope>)\n+testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'\n// @DataJpaTest: spring-boot-starter-data-jpa-test, package org.springframework.boot.data.jpa.test.autoconfigure"},"repro":"none","check":"./gradlew compileTestJava (Maven - mvn test-compile)","notes":"Maven prints it after [ERROR] <file>:[l,c]. @AutoConfigureWebTestClient: add spring-boot-webtestclient (not spring-boot-webclient-test), package org.springframework.boot.webtestclient.autoconfigure. TestRestTemplate moved to org.springframework.boot.resttestclient.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"4.0","status":"works"}],"dead_ends":[{"attempt":"add spring-boot-starter-test-classic and keep the 3.x import","why":"classic starters put the 4.x modules on the classpath, not the old packages; AutoConfigureMockMvc exists only in org.springframework.boot.webmvc.test.autoconfigure","reports":1},{"attempt":"drop @AutoConfigureMockMvc and autowire MockMvc in a plain @SpringBootTest","why":"Boot 4's @SpringBootTest no longer provides any MockMvc support; without the annotation there is no MockMvc bean","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-05T18:24:49.715919Z","updated_at":"2026-11-05T18:24:49.715919Z","last_confirmed_at":null,"ledger":{"first_seq":190,"last_seq":190,"head_hash":"616ccba3a2b80a4063d187fd9976928da9091da19f1e03786f328eeb33c8be12"}}
