Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteIn Spring Boot, a vertical slice groups the code for a business capability—such as placing an order—across the technical layers it needs. Testing that slice is different from using Boot’s technical test slices: @WebMvcTest focuses on MVC, while @DataJpaTest focuses on JPA. For a functional module tested across its layers, Spring Modulith provides @ApplicationModuleTest.
What a vertical slice means in a Spring Boot application
A vertical slice organizes code around a capability or domain module rather than placing all controllers, services, and repositories in application-wide technical folders. The module can contain several technical layers, while exposing a defined interface to other modules.
As an Amazon Associate I earn from qualifying purchases.
Spring Modulith describes an application module in terms of a provided interface (Spring beans and published events available to other modules), internal implementation that other modules should not access, and required interfaces to other modules. By default, its convention treats direct sub-packages of the package containing the main Spring Boot application class as application modules. That is a useful convention, not a requirement for every vertical-slice design.
Free tools Windows power users keep installed
One-click scans. No signup required.
com.example.shop
ShopApplication.java
orders/
OrderController.java
PlaceOrder.java
OrderRepository.java
Order.java
inventory/
InventoryApi.java
InventoryService.java
StockRepository.java
In this example, the orders capability keeps its endpoint, use-case logic, and persistence code together. The inventory module can provide an API or publish events rather than making its internal implementation available to orders. Spring Modulith can help verify module structure and test modules, but it does not prescribe this exact layout. See the Spring Modulith application-module documentation.
#1 Best Overall
Vertical module tests and Boot test slices answer different questions
The word “slice” is used for two different boundaries. Spring Boot test slices narrow the application context around a technical layer. A vertical application module groups functionality that may span several layers. Spring Modulith’s @ApplicationModuleTest can load a module across those layers.
| Approach | Best question to answer | What it loads | Important limit |
|---|---|---|---|
| Plain unit test | Does this object or business rule behave correctly? | Objects constructed directly, without Spring when possible | Does not prove Spring wiring or framework integration. |
@WebMvcTest |
Does an MVC endpoint handle requests correctly? | MVC infrastructure and selected MVC components, including MockMvc |
Ordinary components and configuration-properties beans are not scanned by default. |
@DataJpaTest |
Do JPA mappings and repository operations behave correctly? | JPA entities, repositories, and database test setup | An embedded database may not reproduce production database behavior. |
@ApplicationModuleTest |
Does one functional module work across its layers? | The current application module, optionally with dependencies | External module beans must be included or replaced when needed. |
@SpringBootTest |
Does broad application wiring or an end-to-end path work? | The application context, with an optional mock or real web environment | Use the broader scope when the behavior under test requires it. |
These scopes are not a hierarchy of test quality. Choose the narrowest boundary that includes the behavior you need to prove. Spring Boot’s testing documentation describes Boot’s test annotations and context setup; Spring Modulith’s testing guide describes module-level testing and combining module and technical boundaries.
Rank #2
Choose the test boundary that matches the behavior
Test business rules without starting Spring
If a rule can be tested by constructing its objects and passing inputs directly, use a plain unit test. It verifies the rule without asserting that Spring can wire the application. Bring in a Spring context when the behavior actually depends on framework integration.
Use @WebMvcTest for controller behavior
Use this focused test for request mapping, validation, serialization, and MVC exception handling. It configures Spring MVC and MockMvc, while limiting component scanning to MVC-related types. Ordinary @Component and @ConfigurationProperties beans are not scanned by default, so provide required collaborators as test doubles or import only the configuration the test needs. If the application uses Spring Security, use its test support rather than assuming security behavior is absent.
Rank #3
Use @DataJpaTest for persistence behavior
This annotation is for entity mapping and repository behavior. It scans entities and configures Spring Data JPA repositories. When an embedded database is on the test classpath, Boot configures one; tests are transactional and roll back by default. An embedded database is not evidence that vendor-specific production behavior—such as dialect handling or locking—works. Configure the test to use the real database when that behavior matters.
Use @ApplicationModuleTest for a capability spanning layers
Place the test in the module package or one of its sub-packages, add Spring Modulith’s test support, and annotate the test with @ApplicationModuleTest. It boots the module containing the test in an integration-test context, rather than requiring the entire application to be loaded.
Rank #4
Choose a bootstrap mode according to the module’s dependencies:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →STANDALONE: the current module only.DIRECT_DEPENDENCIES: the current module and its direct dependencies.ALL_DEPENDENCIES: the current module and its dependency tree.
If the test cannot start because the module needs a bean from another module, either include the needed module deliberately or replace the external bean with @MockitoBean. A module that requires many beans from other modules may be highly coupled; review whether its boundaries are clear and whether an event-based interaction would fit. Events are a design option, not an automatic improvement.
Combine module and technical scope when only one layer matters
If the question is specifically about the repository layer inside one functional module, Spring Modulith documents combining @ModuleSlicing with a Boot slice such as @DataJpaTest. This applies both boundaries: the functional module and the technical layer. It is distinct from @ApplicationModuleTest, which tests the module across its layers.
Reserve @SpringBootTest for application-wide behavior
@SpringBootTest creates an application context through SpringApplication. By default it does not start a server; its webEnvironment setting can select a mock environment or a real server on a random port. Use a real server when the behavior depends on actual HTTP-server startup or network communication, not simply because the test concerns an endpoint.
What to check when a focused test fails to start
- A required bean is missing: a test slice intentionally excludes many application components. Add a test double or import the specific configuration required rather than broadening the context immediately.
- Boot’s slice scans too much or too little: an explicit
@ComponentScanon the main@SpringBootApplicationcan disable the default filters used by test slicing. Consider moving custom scanning to separate configuration or restoring the relevant filters. - A module test needs another module: include the necessary dependency through the selected bootstrap mode, or replace the external bean with
@MockitoBean. Repeated cross-module requirements can be a reason to examine coupling. - A persistence test passes locally but production behavior is uncertain: verify the behavior against the production database when dialect-specific, locking, or other vendor-specific behavior is part of the claim.
Spring’s test framework caches application contexts between tests that share configuration. A context-based test therefore does not necessarily reload the application for every test method.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsKeep examples aligned with the Spring Boot version
Spring Boot’s testing modules, package names, and dependency coordinates vary by release. The official reference listed stable documentation versions 4.1.1 and 3.5.16 on October 7, 2026. Select one Boot release for a project and use its matching documentation and dependencies; do not combine snippets from different generations. Spring Modulith’s cited reference pages do not establish a specific release here, so the examples do not claim one.
As the Spring Boot Reference Documentation puts it: “A Spring Boot application is a Spring ApplicationContext, so nothing very special has to be done to test it beyond what you would normally do with a vanilla Spring context.” The practical question is not whether every test should use that full context, but which context contains the behavior the test is meant to verify.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




