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
- 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
- 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
- In a @SpringBootTest test, what webEnvironment setting starts an actual HTTP server on a random port? → RANDOM_PORT
- Which annotation triggers Bean Validation on a method parameter in a Spring MVC controller? → @Valid
- How can you inject a mock bean into the Spring application context using Mockito? → @MockBean
- Which Spring Boot feature allows config values to be resolved from a Vault or Config Server at startup? → spring.config.import
- Which method on `JpaRepository` fetches an entity and throws `EmptyResultDataAccessException` if not found? → findById()
- What HTTP status code should a well-designed REST API return when a request body fails Bean Validation? → 400 Bad Request
- Which annotation marks a method as a bean producer inside a @Configuration class? → @Bean
- What annotation is used to designate a method as a Kafka message consumer in Spring Boot? → @KafkaListener
- 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
- 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
- A table's primary key must be annotated. → @Id
- Which Spring feature allows you to conditionally register a bean based on the presence of a class on the classpath? → @ConditionalOnClass
- In Spring AOP, which join point type is supported? → Method execution
- Which propagation behavior creates a new transaction and suspends the current one? → REQUIRES_NEW
- What is the purpose of spring.profiles.default? → It specifies profiles activated when no active profiles are set
- Which property prefix is used to configure the embedded Tomcat server's port in a Spring Boot application? → server.port
- Which Spring annotation enables component scanning for a specific base package? → @ComponentScan
- What Spring Boot property configures the default transaction timeout? → spring.transaction.default-timeout
- What is a 'phantom read' in database transactions? → A query returning different sets of rows due to inserts by another concurrent transaction
- What does `spring.jpa.show-sql=true` do in a Spring Boot application? → Logs all SQL statements generated by Hibernate to the console
- Which Spring Boot actuator endpoint exposes the resolved configuration properties? → /actuator/env
- Which Spring Security component is responsible for converting a successful authentication into a granted authority list? → GrantedAuthoritiesMapper
- Which Spring mechanism allows you to register beans programmatically after the ApplicationContext has started? → BeanDefinitionRegistry.registerBeanDefinition()
- Which annotation defines a bi-directional one-to-many relationship's inverse (non-owning) side? → @MappedBy on @OneToMany
- In spring boot, what is the default HTML template engine? → Thymeleaf
- Which annotation marks a field as the primary key in a JPA entity? → @Id
- What is the role of the @PathVariable annotation in Spring REST controllers? → Binds a URI template variable to a method parameter
- Which starter would you add to enable WebSocket support in a Spring Boot application? → spring-boot-starter-websocket
Turn these facts into recall:
Was this helpful?