Question 1: What is the main advantage of Spring Boot over Spring Framework?
- Better UI support
- Auto-configuration and reduced boilerplate
- Faster JVM execution
- Built-in database
Explanation: Spring Boot reduces boilerplate using auto-configuration.
This intermediate Spring Boot quiz focuses on applied concepts like auto-configuration, REST APIs, data access, validation, and real-world usage. Ideal for developers who know the basics and want to prepare for Spring Boot interviews and production applications.
Explanation: Spring Boot reduces boilerplate using auto-configuration.
Explanation: @SpringBootApplication combines these three annotations.
Explanation: Auto-configuration depends on classpath dependencies.
Explanation: application.yml supports hierarchical configuration.
Explanation: @Profile activates beans for specific environments.
Explanation: spring.profiles.active is defined in application.properties.
Explanation: spring-boot-starter-data-jpa provides JPA support.
Explanation: PagingAndSortingRepository provides paging and sorting.
Explanation: Exceptions are handled locally at controller level.
Explanation: @ResponseStatus sets custom HTTP status.
Explanation: PATCH is used for partial updates.
Explanation: @PatchMapping maps PATCH requests.
Explanation: CommandLineRunner executes code at application startup.
Explanation: @EnableCaching activates cache support.
Explanation: @Cacheable stores method results in cache.
Explanation: Auto-config can be excluded using exclude attribute.
Explanation: Spring Actuator exposes metrics and health endpoints.
Explanation: /beans lists all Spring beans.
Explanation: @Validated enables method-level validation.
Explanation: @Valid triggers validation on request body.
Explanation: @EnableAsync enables async execution.
Explanation: CompletableFuture provides better async handling.
Explanation: server.port changes the default port.
Explanation: @ConfigurationProperties binds external properties.
Explanation: It must be registered as a Spring bean.
Explanation: @ControllerAdvice can be used for global CORS config.
Explanation: H2 dependency provides in-memory database.
Explanation: @EnableScheduling enables scheduled execution.
Explanation: spring.jpa.show-sql logs SQL queries.
Explanation: @Configuration marks configuration classes.
Explanation: 204 means no content.
Explanation: @RequestPart handles multipart file uploads.
Explanation: ApplicationRunner runs code after startup.
Explanation: @EnableTransactionManagement enables transactions.
Explanation: @Transactional rolls back on runtime exceptions.
Explanation: @PreAuthorize secures methods.
Explanation: spring-boot-starter-security provides security support.
Explanation: SpringApplication runs the app.
Explanation: @PathVariable binds path values.
Explanation: PUT is idempotent.
Explanation: Spring Boot uses SLF4J facade.
Explanation: It enables scanning of configuration properties.
Explanation: /env exposes environment properties.
Explanation: @JsonProperty customizes JSON fields.
Explanation: @RestControllerAdvice handles global REST exceptions.
Explanation: 400 indicates bad request.
Explanation: @EnableWebMvc enables MVC configuration.
Explanation: Spring Boot supports externalized configuration.
This intermediate Spring Boot quiz focuses on applied concepts like auto-configuration, REST APIs, data access, validation, and real-world usage. Ideal for developers who know the basics and want to prepare for Spring Boot interviews and production applications.