Spring Boot Cheat Sheet 2026

The 30 highest-yield Spring Boot facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.

60 questions
130 min time limit
76.00% to pass
  1. What does the `@Cacheable` annotation do when applied to a Spring service method? Caches the method return value using the method arguments as the key
  2. What does the antMatcher (or requestMatchers in Spring Security 6) method do in an HttpSecurity configuration? It applies the security configuration only to requests matching the specified pattern
  3. In a @SpringBootTest test, what webEnvironment setting starts an actual HTTP server on a random port? RANDOM_PORT
  4. Which annotation triggers Bean Validation on a method parameter in a Spring MVC controller? @Valid
  5. How can you inject a mock bean into the Spring application context using Mockito? @MockBean
  6. Which Spring Boot feature allows config values to be resolved from a Vault or Config Server at startup? spring.config.import
  7. Which method on `JpaRepository` fetches an entity and throws `EmptyResultDataAccessException` if not found? findById()
  8. What HTTP status code should a well-designed REST API return when a request body fails Bean Validation? 400 Bad Request
  9. Which annotation marks a method as a bean producer inside a @Configuration class? @Bean
  10. What annotation is used to designate a method as a Kafka message consumer in Spring Boot? @KafkaListener
  11. How do you bind a method's return value inside an @AfterReturning advice? Set the 'returning' attribute on @AfterReturning to match a method parameter name
  12. A developer needs to create a new instance of a `ShoppingCart` bean every time a user starts a new HTTP session. Which bean scope should be used? session
  13. A table's primary key must be annotated. @Id
  14. Which Spring feature allows you to conditionally register a bean based on the presence of a class on the classpath? @ConditionalOnClass
  15. In Spring AOP, which join point type is supported? Method execution
  16. Which propagation behavior creates a new transaction and suspends the current one? REQUIRES_NEW
  17. What is the purpose of spring.profiles.default? It specifies profiles activated when no active profiles are set
  18. Which property prefix is used to configure the embedded Tomcat server's port in a Spring Boot application? server.port
  19. Which Spring annotation enables component scanning for a specific base package? @ComponentScan
  20. What Spring Boot property configures the default transaction timeout? spring.transaction.default-timeout
  21. What is a 'phantom read' in database transactions? A query returning different sets of rows due to inserts by another concurrent transaction
  22. What does `spring.jpa.show-sql=true` do in a Spring Boot application? Logs all SQL statements generated by Hibernate to the console
  23. Which Spring Boot actuator endpoint exposes the resolved configuration properties? /actuator/env
  24. Which Spring Security component is responsible for converting a successful authentication into a granted authority list? GrantedAuthoritiesMapper
  25. Which Spring mechanism allows you to register beans programmatically after the ApplicationContext has started? BeanDefinitionRegistry.registerBeanDefinition()
  26. Which annotation defines a bi-directional one-to-many relationship's inverse (non-owning) side? @MappedBy on @OneToMany
  27. In spring boot, what is the default HTML template engine? Thymeleaf
  28. Which annotation marks a field as the primary key in a JPA entity? @Id
  29. What is the role of the @PathVariable annotation in Spring REST controllers? Binds a URI template variable to a method parameter
  30. Which starter would you add to enable WebSocket support in a Spring Boot application? spring-boot-starter-websocket
Was this helpful?