What is the significance of the @Cacheable annotation in Spring Boot?
In Spring Boot, @Cacheable plus a cache starter and provider gives you fast, configurable method caching. See Caffeine and Redis setups with expiry.
2,886 posts about Java: questions with answers, tutorials and articles, newest first.
In Spring Boot, @Cacheable plus a cache starter and provider gives you fast, configurable method caching. See Caffeine and Redis setups with expiry.
Follow one REST resource through reads and writes in Spring Boot, with server-side cache annotations, conditional GET with ETag, and a Cache-Control policy table.
Compare the main load testing tools for Spring Boot APIs, with Gatling, k6 and Locust examples and how to monitor the app with Actuator.
Plan a realistic workload, run Gatling, k6 or JMeter against a staging environment, and use Actuator metrics to find and fix Spring Boot bottlenecks.
MockMvc is a class, not an annotation. See how @WebMvcTest and @AutoConfigureMockMvc provide it and how to test REST endpoints with GET, POST and DELETE requests.
Test Spring Boot REST controllers with @WebMvcTest, MockMvc and @MockitoBean: GET, POST, DELETE, validation errors and JSON assertions.
@WebMvcTest loads only the web layer so controller tests run fast. See what it includes, a MockMvc example and the move from @MockBean to @MockitoBean.
Trigger each failure through MockMvc and assert status, media type and error body fields. Includes ProblemDetail handlers, validation tests and full-server checks.
TestRestTemplate is a test-friendly HTTP client for Spring Boot integration tests. It calls your running app on a random port and returns error responses instead of throwing.
@MockBean registers a Mockito mock in the Spring test context so you can isolate a component. It is deprecated in favour of @MockitoBean.
Replace external clients with @MockitoBean, fake HTTP calls with MockRestServiceServer or WireMock, and test error paths without touching real services.
How @SpringBootTest fits into Spring Boot testing, from real database integration tests to mocking boundaries and keeping the context cache effective.
Test Spring Boot REST endpoints end to end with @SpringBootTest, MockMvc or a real HTTP client, and a Testcontainers database that matches production.
Learn how to map bidirectional JPA relationships correctly: owning vs inverse side, mappedBy, sync helpers, cascading and common pitfalls.
FetchType tells JPA when to load data, EAGER at once or LAZY on first access. Learn the defaults per mapping, common errors and per-query fixes.
CascadeType lists the six EntityManager operations that propagate to related entities in JPA: PERSIST, MERGE, REMOVE, REFRESH, DETACH and ALL. See what each does and when to use it.
MockMvc sends simulated HTTP requests to Spring MVC controllers so you can test mappings, validation and JSON fast. See setup and examples.
Use the cascade attribute and orphanRemoval to propagate persist, merge and remove from a parent entity to its children, and know when not to.
Combine @WebMvcTest with MockMvc, @DataJpaTest and @SpringBootTest to test controllers, repositories and full REST flows, using @MockitoBean on current Boot.
@IdClass maps a composite primary key by pairing an entity's @Id fields with a separate Serializable key class. See the rules, examples and how it compares to @EmbeddedId.